Automatically Close Comments in WordPress After Few Days

You type a controversial post, you get a flurry of comments and they keep coming as your post is digged, slashdotted … and then after a few days the post is forgotten in the archives to be picked up a year later by an occasional Googler, who decides to leave a comment, that features now in your recent comments in the sidebar and restarts the comment boom on an outdated, not-to-be-discussed now post. Remember many people look at the post date of an actively discussed article after the comment is posted and live and they have no way to change it.

A simple way to do it is to simply turn off comments in an individual post. But doing it to hundreds of posts after a period of time is difficult, especially if you are a popular quick posting blogger.

I found this Auto Shutoff Comments wordpress plugin on the official wordpress codex. It is a raw text code which you paste in any text editor like notepad in Windows and save as autoshutoff.php, then simply upload to your WordPress plugin folders and activate it. It will autoclose comments after 21 days. I think you can change the number of days it closes by tweaking the 21 value.

// Set $age to the age at which a post should become stale
$age = '21 DAY';

I have no need to use it now, but if you are looking for a simple solution to close off comments after a few days automatically, give it a try.

7 comments on “Automatically Close Comments in WordPress After Few Days

  1. Sarit says:

    I like the way you presented the plugin, telling a possible situation.
    Thanks for recommending.

  2. Brad says:

    I love how 3 years after posting this article, it is still open to comments. Oh the irony…

  3. Andy Gabriel says:

    When I originally commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get four emails with the same comment. Is there any way you can remove me from that service?Thanks

  4. Infographiste PAO says:

    Very useful tuto, thanks for sharing

  5. Fajne Gry says:

    Thanks For This Post, was added to my bookmarks.

  6. Wakacje says:

    I just book marked your blog on Digg and StumbleUpon.I enjoy reading your commentaries.

  7. Kosmetyki Noni says:

    Very informative post. Thanks for taking the time to share your view with us.

Leave a Reply

Your email address will not be published. Required fields are marked *

All comments moderated. Use True name. No irrelevant links. Post useful content.