post_date_gmt) > (30 * 24 * 60 * 60)) { $posts[0]->comment_status = 'closed'; $posts[0]->ping_status = 'closed'; } return $posts; } add_filter('the_posts', 'close_comments');