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.7.2

apply_filters('close_comments_for_post_types') is found 2 times:

  • /wp-includes/comment.php line 3406
    3402
    3403
    3404
    3405
    3406
    3407
    3408
    3409
    3410
    3411
    3412
    * @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 3451
    3448
    3449
    3450
    3451
    3452
    3453
    3454
    3455
    3456
    3457
    $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 ) {