get_comment_text()获取一个评论的正文内容

目录

描述

Retrieve the text of the current comment.

Use comment_text to display the comment text.

get_comment_text() 描述

用法

<?php get_comment_text$comment_ID ?>

get_comment_text() 用法

参数

comment_ID

(integer) (可选) The ID of the comment for which to get the text.

默认值: 0 (the current comment)

get_comment_text() 参数

源文件

get_comment_text() 函数的代码位于 wp-includes/comment-template.php

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */
/**
 * Retrieve the text of the current comment.
 *
 * @since 1.5.0
 *
 * @see Walker_Comment::comment()
 *
 * @param int   $comment_ID ID of the comment for which to get the text. Default current comment.
 * @param array $args       Optional. An array of arguments. Default empty.
 * @return string The comment content.
 */
function get_comment_text( $comment_ID = 0, $args = array() ) {
	$comment = get_comment( $comment_ID );

	/**
	 * Filter the text of a comment.
	 *
	 * @since 1.5.0
	 *
	 * @see Walker_Comment::comment()
	 *
	 * @param string $comment_content Text of the comment.
	 * @param object $comment         The comment object.
	 * @param array  $args            An array of arguments.
	 */
	return apply_filters( 'get_comment_text', $comment->comment_content, $comment, $args );
}

get_comment_text() 源文件

相关