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 |
|---|---|
| 3282 | } |
| 3283 | |
| 3284 | /** |
| 3285 | * Filters the list of post types to automatically close comments for. |
| 3286 | * |
| 3287 | * @since 3.2.0 |
| 3288 | * |
| 3289 | * @param string[] $post_types An array of post type names. |
| 3290 | */ |
| 3291 | $post_types = apply_filters( 'close_comments_for_post_types', array( 'post' ) ); |
| 3292 | if ( ! in_array( $posts[0]->post_type, $post_types, true ) ) { |
| 3293 | return $posts; |
| 3294 | } |
| 3295 | |
| 3296 | $days_old = (int) get_option( 'close_comments_days_old' ); |
| 3297 | if ( ! $days_old ) { |
| 3298 | return $posts; |
| 3299 | } |
| 3300 | |
| Line | Code |
| 3327 | |
| 3328 | $days_old = (int) get_option( 'close_comments_days_old' ); |
| 3329 | if ( ! $days_old ) { |
| 3330 | return $open; |
| 3331 | } |
| 3332 | |
| 3333 | $post = get_post( $post_id ); |
| 3334 | |
| 3335 | /** This filter is documented in wp-includes/comment.php */ |
| 3336 | $post_types = apply_filters( 'close_comments_for_post_types', array( 'post' ) ); |
| 3337 | if ( ! in_array( $post->post_type, $post_types, true ) ) { |
| 3338 | return $open; |
| 3339 | } |
| 3340 | |
| 3341 | // Undated drafts should not show up as comments closed. |
| 3342 | if ( '0000-00-00 00:00:00' === $post->post_date_gmt ) { |
| 3343 | return $open; |
| 3344 | } |
| 3345 | |