显示当前评论的文本。
原型
comment_text( int|WP_Comment $comment_ID, array $args = array() )
参数
$comment_ID
(int|WP_Comment)
(Required)
WP_Comment或要为其打印文本的注释的ID。默认当前评论。
$args
(array)
(Optional)
一组参数。
源文件
路径:wp-includes/comment-template.php
<?php
...
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 );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/comment_text/