diff --git a/close-old-comments.php b/close-old-comments.php index d8dde639b0c308b728f7e14d4dbcf1bdabadf160..166b036127b1406d8d16ec299c68e095a5570cd0 100644 --- a/close-old-comments.php +++ b/close-old-comments.php @@ -27,4 +27,17 @@ function override_close_comments_days_old($value, $option){ } add_filter('option_close_comments_days_old', 'override_close_comments_days_old', 10, 2); +# Filter on 'close_comments_for_post_types' +# which post_types do we need to close automatically after X days? +# Wordpress defaults to 'posts' (but let's check if got removed and add it back) +add_filter('close_comments_for_post_types', function ($post_types){ + if (! in_post_types('post'), $post_types ){ + $post_types[] = 'post'; + } + $post_types[] = 'page'; + $post_types[] = 'attachment'; + + return $post_types; +}); + ?>