get_comment_id_fields

Advertisement

Summery Summery

Retrieves hidden input HTML for replying to comments.

Syntax Syntax

get_comment_id_fields( int $id )

Parameters Parameters

$id

(Optional) Post ID. Default current post ID.

Return Return

(string) Hidden input HTML for replying to comments

Source Source

File: wp-includes/comment-template.php

	echo get_cancel_comment_reply_link( $text );
}

/**
 * Retrieves hidden input HTML for replying to comments.
 *
 * @since 3.0.0
 *
 * @param int $post_id Optional. Post ID. Defaults to the current post ID.
 * @return string Hidden input HTML for replying to comments.
 */
function get_comment_id_fields( $post_id = 0 ) {
	if ( empty( $post_id ) ) {
		$post_id = get_the_ID();
	}

	$reply_to_id = isset( $_GET['replytocom'] ) ? (int) $_GET['replytocom'] : 0;
	$result      = "<input type='hidden' name='comment_post_ID' value='$post_id' id='comment_post_ID' />\n";
	$result     .= "<input type='hidden' name='comment_parent' id='comment_parent' value='$reply_to_id' />\n";

Advertisement

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.

Advertisement

Leave a Reply