WordPress 升级新版本后评论内容不显示
2019年11月16日 17:53:13 WordPress ⁄ 共 830字 暂无评论 ⁄ 被围观 3,487次

升级了 wordpress 新版本,评论内容丢失,该如何解决。。。

找到 \wp-includes\comment-template.php 文件,搜索函数名:comment_text。

源代码如下:

  1. function comment_text( $comment_ID = 0, $args = array() ) {  
  2.     $comment = get_comment( $comment_ID );  
  3.   
  4.     $comment_text = get_comment_text( $comment$args );  
  5.     /** 
  6.      * Filters the text of a comment to be displayed. 
  7.      * 
  8.      * @since 1.2.0 
  9.      * 
  10.      * @see Walker_Comment::comment() 
  11.      * 
  12.      * @param string          $comment_text Text of the current comment. 
  13.      * @param WP_Comment|null $comment      The comment object. 
  14.      * @param array           $args         An array of arguments. 
  15.      */  
  16.     echo apply_filters( 'comment_text', $comment_text$comment$args );  
  17. }  

修改为:

  1. function comment_text( $comment_ID = 0 ) {  
  2.     $comment = get_comment( $comment_ID );  
  3.     echo(get_comment_text( $comment_ID ));  
  4. }  

给我留言

留言无头像?