close_comments_for_post_types

close_comments_for_post_types

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: wordpress-6.4.3

apply_filters('close_comments_for_post_types') is found 2 times:

  • /wp-includes/comment.php line 3377
    	 * @since 3.2.0
    	 *
    	 * @param string[] $post_types An array of post type names.
    	 */
    	$post_types = apply_filters( 'close_comments_for_post_types', array( 'post' ) );
    	if ( ! in_array( $posts[0]->post_type, $post_types, true ) ) {
    		return $posts;
    	}
    
    	$days_old = (int) get_option( 'close_comments_days_old' );
    	if ( ! $days_old ) {
    
  • /wp-includes/comment.php line 3422
     
    	$post = get_post( $post_id );
    
    	/** This filter is documented in wp-includes/comment.php */
    	$post_types = apply_filters( 'close_comments_for_post_types', array( 'post' ) );
    	if ( ! in_array( $post->post_type, $post_types, true ) ) {
    		return $open;
    	}
    
    	// Undated drafts should not show up as comments closed.
    	if ( '0000-00-00 00:00:00' === $post->post_date_gmt ) {