升级了 wordpress 新版本,评论内容丢失,该如何解决。。。
找到 \wp-includes\comment-template.php 文件,搜索函数名:comment_text。
源代码如下:
- 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 ));
- }