检索隐藏的输入HTML以回复评论。

原型

get_comment_id_fields( int $id )

参数

$id (int) (Optional)  帖子ID。默认当前帖子ID。

返回值

(string)  用于回复评论的隐藏输入HTML

源文件

路径:wp-includes/comment-template.php

<?php
...
function get_comment_id_fields( $id = 0 ) {
	if ( empty( $id ) )
		$id = get_the_ID();
	$replytoid = isset($_GET['replytocom']) ? (int) $_GET['replytocom'] : 0;
	$result  = "<input type='hidden' name='comment_post_ID' value='$id' id='comment_post_ID' />n";
	$result .= "<input type='hidden' name='comment_parent' id='comment_parent' value='$replytoid' />n";
	/**
	 * Filters the returned comment id fields.
	 *
	 * @since 3.0.0
	 *
	 * @param string $result    The HTML-formatted hidden id field comment elements.
	 * @param int    $id        The post ID.
	 * @param int    $replytoid The id of the comment being replied to.
	 */
	return apply_filters( 'comment_id_fields', $result, $id, $replytoid );
}
...
?>

其他

英文文档:https://developer.wordpress.org/reference/functions/get_comment_id_fields/