Time to Close Comments

The WordPress 2.7 core has a setting to close comments for posts which exceed a user specified aging. Unfortunately, the core doesn’t differentiate between posts and pages. Since I need additional control, I use this wonderful plugin.

Given a choice, I would prefer if the plugin would filter the comment_status page when the post is called and change its value based on aging. This functionality would prevent having to send scheduled update queries to the posts table. I believe the core functionality works this way.

Update Feb 24, 2009 – I decided to have a go at making a theme function that would mimic the core’s behavior of closing the old posts on the fly without additional queries while preserving comments on pages. It was pretty simple. You have to remove the filter (‘the_posts’, ‘_close_comments_for_old_posts’ ), copy the function _close_comments_for_old_posts from /wp-includes/comment.php, modify it to do an is_page() check, rename your new function and then add the new filter (‘the_posts,’your_function_name’) after you’ve defined it.

Ajay’s plugin will still allow you to keep specific posts open so there’s more functionality than what I need so my solution isn’t a replacement.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.