wp-includes/comment-template.php:1311Determines whether the current post is open for comments.
$postint|WP_PostoptionalnullboolOne hook fires while comments_open() runs, in this order:
Filters whether the current post is open for comments.
function comments_open( $post = null ) { $_post = get_post( $post ); $post_id = $_post ? $_post->ID : 0; $comments_open = ( $_post && ( 'open' === $_post->comment_status ) ); /** * Filters whether the current post is open for comments. * * @since 2.5.0 * * @param bool $comments_open Whether the current post is open for comments. * @param int $post_id The post ID. */ return apply_filters( 'comments_open', $comments_open, $post_id );}Introduced in 1.5.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
src/wp-includes/comment-template.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.