Title: post_comment_status_meta_box
Published: April 25, 2014
Last modified: May 20, 2026

---

# post_comment_status_meta_box( WP_Post $post )

## In this article

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

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

Displays comments status form fields.

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/post_comment_status_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_status_meta_box/?output_format=md#source)󠁿

    ```php
    function post_comment_status_meta_box( $post ) {
    	?>
    <input name="advanced_view" type="hidden" value="1" />
    <p class="meta-options">
    	<label for="comment_status" class="selectit"><input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked( $post->comment_status, 'open' ); ?> /> <?php _e( 'Allow comments' ); ?></label><br />
    	<label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked( $post->ping_status, 'open' ); ?> />
    		<?php
    		printf(
    			/* translators: %s: Documentation URL. */
    			__( 'Allow <a href="%s">trackbacks and pingbacks</a>' ),
    			__( 'https://wordpress.org/documentation/article/introduction-to-blogging/#managing-comments' )
    		);
    		?>
    	</label>
    	<?php
    	/**
    	 * Fires at the end of the Discussion meta box on the post editing screen.
    	 *
    	 * @since 3.1.0
    	 *
    	 * @param WP_Post $post WP_Post object for the current post.
    	 */
    	do_action( 'post_comment_status_meta_box-options', $post ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
    	?>
    </p>
    	<?php
    }
    ```

[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/7.0/src/wp-admin/includes/meta-boxes.php#L847)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-admin/includes/meta-boxes.php#L847-L873)

## 󠀁[Hooks](https://developer.wordpress.org/reference/functions/post_comment_status_meta_box/?output_format=md#hooks)󠁿

 [do_action( ‘post_comment_status_meta_box-options’, WP_Post $post )](https://developer.wordpress.org/reference/hooks/post_comment_status_meta_box-options/)

Fires at the end of the Discussion meta box on the post editing screen.

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

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

Outputs the HTML checked attribute.

  | 
| [_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.

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

Calls the callback functions that have been added to an action hook.

  |

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

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

| Version | Description | 
| [2.6.0](https://developer.wordpress.org/reference/since/2.6.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_status_meta_box%2F)
before being able to contribute a note or feedback.