先申明,我已经调用了WordPress评论模板代码;结果,最近博主发现网站前台/后台的评论显示不出来了。怎么办呢?博主经过查找资料并测试,得出解决办法,具体如下:
解决方法
1、打开目录 \wp-includes,找到 comment-template.php 文件。
2、搜索函数“function comment_text”(无双引号)找到如图所示的地方:
3、将:
function comment_text( $comment_ID = 0, $args = array() ) {
$comment = get_comment( $comment_ID );
$comment_text = get_comment_text( $comment, $args );
/**
* Filters the text of a comment to be displayed.
*
* @since 1.2.0
*
* @see Walker_Comment::comment()
*
* @param string $comment_text Text of the current comment.
* @param WP_Comment|null $comment The comment object.
* @param array $args An array of arguments.
*/
echo apply_filters( 'comment_text', $comment_text, $comment, $args );
}
修改为:
function comment_text( $comment_ID = 0 ) {
$comment = get_comment( $comment_ID );
echo(get_comment_text( $comment_ID ));
}
4、保存文件,并重新刷新网页即可正常!