WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )
apply_filters( "hook_name", "what_to_filter" )
.Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 2 times in this file.
Line | Code |
---|---|
3358 | } |
3359 |
|
3360 | /** |
3361 | * Filters the list of post types to automatically close comments for. |
3362 | * |
3363 | * @since 3.2.0 |
3364 | * |
3365 | * @param string[] $post_types An array of post type names. |
3366 | */ |
3367 | $post_types = apply_filters( 'close_comments_for_post_types', array( 'post' ) ); |
3368 | if ( ! in_array( $posts[0]->post_type, $post_types, true ) ) { |
3369 | return $posts; |
3370 | } |
3371 |
|
3372 | $days_old = (int) get_option( 'close_comments_days_old' ); |
3373 | if ( ! $days_old ) { |
3374 | return $posts; |
3375 | } |
3376 |
|
Line | Code |
3403 |
|
3404 | $days_old = (int) get_option( 'close_comments_days_old' ); |
3405 | if ( ! $days_old ) { |
3406 | return $open; |
3407 | } |
3408 |
|
3409 | $post = get_post( $post_id ); |
3410 |
|
3411 | /** This filter is documented in wp-includes/comment.php */ |
3412 | $post_types = apply_filters( 'close_comments_for_post_types', array( 'post' ) ); |
3413 | if ( ! in_array( $post->post_type, $post_types, true ) ) { |
3414 | return $open; |
3415 | } |
3416 |
|
3417 | // Undated drafts should not show up as comments closed. |
3418 | if ( '0000-00-00 00:00:00' === $post->post_date_gmt ) { |
3419 | return $open; |
3420 | } |
3421 |
|