comment_text

函式
comment_text ( $comment_ID = 0, $args = array() )
引數
  • (int|WP_Comment) $comment_ID WP_Comment or ID of the comment for which to print the text. Default current comment.
    Required:
  • (array) $args Optional. An array of arguments. Default empty array.
    Required:
    Default: array()
相關
  • Walker_Comment::comment()
定義位置
相關方法
comment_text_rssget_comment_textcomment_existscomment_timecomment_type
引入
0.71
棄用
-

comment_text用於顯示評論的文字。它不需要引數,只是輸出評論的內容。你通常會在WordPress的迴圈中使用這個函式來顯示某個特定文章的評論。

顯示當前評論的文字。

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. Null if not found.
	 * @param array           $args         An array of arguments.
	 */
	echo apply_filters( 'comment_text', $comment_text, $comment, $args );
}

常見問題

FAQs
檢視更多 >