Title: comment_id_fields
Published: April 25, 2014
Last modified: February 24, 2026

---

# comment_id_fields( int|WP_Post|null $post = null )

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/comment_id_fields/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/functions/comment_id_fields/?output_format=md#see-also)
 * [Parameters](https://developer.wordpress.org/reference/functions/comment_id_fields/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/functions/comment_id_fields/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/comment_id_fields/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/comment_id_fields/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/comment_id_fields/?output_format=md#wp--skip-link--target)

Outputs hidden input HTML for replying to comments.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/comment_id_fields/?output_format=md#description)󠁿

Adds two hidden inputs to the comment form to identify the `comment_post_ID` and`
comment_parent` values for threaded comments.

This tag must be within the `<form>` section of the `comments.php` template.

### 󠀁[See also](https://developer.wordpress.org/reference/functions/comment_id_fields/?output_format=md#see-also)󠁿

 * [get_comment_id_fields()](https://developer.wordpress.org/reference/functions/get_comment_id_fields/)

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/comment_id_fields/?output_format=md#parameters)󠁿

 `$post`int|[WP_Post](https://developer.wordpress.org/reference/classes/wp_post/)
|nulloptional

The post the comment is being displayed for.
 Defaults to the current global post.

Default:`null`

## 󠀁[Source](https://developer.wordpress.org/reference/functions/comment_id_fields/?output_format=md#source)󠁿

    ```php
    function comment_id_fields( $post = null ) {
    	echo get_comment_id_fields( $post );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/comment-template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/comment-template.php#L2085)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment-template.php#L2085-L2087)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/comment_id_fields/?output_format=md#related)󠁿

| Uses | Description | 
| [get_comment_id_fields()](https://developer.wordpress.org/reference/functions/get_comment_id_fields/)`wp-includes/comment-template.php` |

Retrieves hidden input HTML for replying to comments.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/comment_id_fields/?output_format=md#changelog)󠁿

| Version | Description | 
| [6.2.0](https://developer.wordpress.org/reference/since/6.2.0/) | Renamed `$post_id` to `$post` and added [WP_Post](https://developer.wordpress.org/reference/classes/wp_post/) support. | 
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fcomment_id_fields%2F)
before being able to contribute a note or feedback.