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.

Share with friends

7
Leave a Reply

avatar
7 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
7 Comment authors
Kosmetyki NoniWakacjeFajne GryInfographiste PAOAndy Gabriel Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Sarit
Sarit

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

Brad
Brad

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

Andy Gabriel
Andy Gabriel

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

Infographiste PAO
Infographiste PAO

Very useful tuto, thanks for sharing

Fajne Gry
Fajne Gry

Thanks For This Post, was added to my bookmarks.

Wakacje
Wakacje

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

Kosmetyki Noni
Kosmetyki Noni

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