/**
* Closes comments on old posts on the fly, without any extra DB queries. Hooked to the_posts.
*
* @since 2.7.0
* @access private
*
* @param WP_Post $posts Post data object.
* @param WP_Query $query Query object.
* @return array
*/
function _close_comments_for_old_posts( $posts,
$query ) { if ( empty( $posts ) || !
$query->
is_singular() || !
get_option( 'close_comments_for_old_posts'
) ) { return $posts;
} /**
* Filters the list of post types to automatically close comments for.
*
* @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'
) );