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 |
---|---|
2790 | return $posts; |
2791 |
|
2792 | /** |
2793 | * Filter the list of post types to automatically close comments for. |
2794 | * |
2795 | * @since 3.2.0 |
2796 | * |
2797 | * @param array $post_types An array of registered post types. Default array with 'post'. |
2798 | */ |
2799 | $post_types = apply_filters( 'close_comments_for_post_types', array( 'post' ) ); |
2800 | if ( ! in_array( $posts[0]->post_type, $post_types ) ) |
2801 | return $posts; |
2802 |
|
2803 | $days_old = (int) get_option( 'close_comments_days_old' ); |
2804 | if ( ! $days_old ) |
2805 | return $posts; |
2806 |
|
2807 | if ( time() - strtotime( $posts[0]->post_date_gmt ) > ( $days_old * DAY_IN_SECONDS ) ) { |
2808 | $posts[0]->comment_status = 'closed'; |
Line | Code |
2830 | return $open; |
2831 |
|
2832 | $days_old = (int) get_option('close_comments_days_old'); |
2833 | if ( !$days_old ) |
2834 | return $open; |
2835 |
|
2836 | $post = get_post($post_id); |
2837 |
|
2838 | /** This filter is documented in wp-includes/comment.php */ |
2839 | $post_types = apply_filters( 'close_comments_for_post_types', array( 'post' ) ); |
2840 | if ( ! in_array( $post->post_type, $post_types ) ) |
2841 | return $open; |
2842 |
|
2843 | if ( time() - strtotime( $post->post_date_gmt ) > ( $days_old * DAY_IN_SECONDS ) ) |
2844 | return false; |
2845 |
|
2846 | return $open; |
2847 | } |
2848 |
|