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

---

# post_comment_meta_box( WP_Post $post )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/post_comment_meta_box/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/functions/post_comment_meta_box/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/post_comment_meta_box/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/post_comment_meta_box/?output_format=md#changelog)

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

Displays comments for post.

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

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

Current post object.

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

    ```php
    function post_comment_meta_box( $post ) {
    	wp_nonce_field( 'get-comments', 'add_comment_nonce', false );
    	?>
    	<p class="hide-if-no-js" id="add-new-comment"><button type="button" class="button" onclick="window.commentReply && commentReply.addcomment(<?php echo $post->ID; ?>);"><?php _e( 'Add Comment' ); ?></button></p>
    	<?php

    	$total         = get_comments(
    		array(
    			'post_id' => $post->ID,
    			'count'   => true,
    			'orderby' => 'none',
    		)
    	);
    	$wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table' );
    	$wp_list_table->display( true );

    	if ( 1 > $total ) {
    		echo '<p id="no-comments">' . __( 'No comments yet.' ) . '</p>';
    	} else {
    		$hidden = get_hidden_meta_boxes( get_current_screen() );
    		if ( ! in_array( 'commentsdiv', $hidden, true ) ) {
    			?>
    			<script type="text/javascript">jQuery(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script>
    			<?php
    		}

    		?>
    		<p class="hide-if-no-js" id="show-comments"><a href="#commentstatusdiv" onclick="commentsBox.load(<?php echo $total; ?>);return false;"><?php _e( 'Show comments' ); ?></a> <span class="spinner"></span></p>
    		<?php
    	}

    	wp_comment_trashnotice();
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/meta-boxes.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-admin/includes/meta-boxes.php#L895)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-admin/includes/meta-boxes.php#L895-L927)

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

| Uses | Description | 
| [get_current_screen()](https://developer.wordpress.org/reference/functions/get_current_screen/)`wp-admin/includes/screen.php` |

Get the current screen object

  | 
| [get_hidden_meta_boxes()](https://developer.wordpress.org/reference/functions/get_hidden_meta_boxes/)`wp-admin/includes/screen.php` |

Gets an array of IDs of hidden meta boxes.

  | 
| [WP_List_Table::display()](https://developer.wordpress.org/reference/classes/wp_list_table/display/)`wp-admin/includes/class-wp-list-table.php` |

Displays the table.

  | 
| [_get_list_table()](https://developer.wordpress.org/reference/functions/_get_list_table/)`wp-admin/includes/list-table.php` |

Fetches an instance of a [WP_List_Table](https://developer.wordpress.org/reference/classes/wp_list_table/) class.

  | 
| [wp_comment_trashnotice()](https://developer.wordpress.org/reference/functions/wp_comment_trashnotice/)`wp-admin/includes/template.php` |

Outputs ‘undo move to Trash’ text for comments.

  | 
| [wp_nonce_field()](https://developer.wordpress.org/reference/functions/wp_nonce_field/)`wp-includes/functions.php` |

Retrieves or display nonce hidden field for forms.

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

Retrieves a list of comments.

  | 
| [_e()](https://developer.wordpress.org/reference/functions/_e/)`wp-includes/l10n.php` |

Displays translated text.

  | 
| [__()](https://developer.wordpress.org/reference/functions/__/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  |

[Show 4 more](https://developer.wordpress.org/reference/functions/post_comment_meta_box/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/post_comment_meta_box/?output_format=md#)

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

| Version | Description | 
| [2.8.0](https://developer.wordpress.org/reference/since/2.8.0/) | Introduced. |

## User Contributed Notes

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