Daily Tip: How to Disable Comments On Older Posts to Cut Down on Spam

August 16, 2010  | 
4 Comments

If you’re getting a fair bit of spam on older blog posts, you may want to disable commenting on posts older than a year or two. Because your posts are still indexed by search engines, you’ll still be getting traffic there, but you may not want the burden of answering questions on posts that are obsolete.

You can easily do this in less than a minute with this SQL query. Sign in to phpmyadmin for your WordPress database and run this query:

UPDATE wp_posts SET comment_status = 'closed' WHERE post_date < '2009-01-01' AND post_status = 'publish';

You can change the date to whatever suits your site’s needs.

Source: Perishable Press

Featured Plugin - Every great SEO tweak you need, in one snazzy bundle

Fully integrated with the SEOMoz API, complete with automatic links, sitemaps and SEO optimization of your WordPress setup - this is the only plugin you need to help you rank your site number 1 on Google - nothing else compares.
Find out more

Featured Plugin - Easily integrate your WordPress site with Facebook

Would you like to add Facebook comments, registration, 'Like' buttons and autoposting to your WP site? Well, The Ultimate Facebook plugin has got that all covered!
Find out more

Featured Plugin - Start Your Own Powerful Membership Site

If you're thinking about starting a paid, or just private, membership site then this is truly the plugin you've been looking for. Easy to use, massively configurable and ready to go out of the box!
Find out more

Featured Plugin - Host sites, get paid, just like WordPress.com

If you've ever wondered how you could offer a paid site management and hosting service, then this is the plugin for you. Offer a freemium or paid service, for any niche you like, it's powered Edublogs.org to success already!
Find out more

Featured Plugin - Open an Online Store with MarketPress

Out of all the WordPress ecommerce plugins available, this has got to be the winner - easy to configure, powerful functionality, multiple gateways and more. A simply brilliant plugin!
Find out more

Featured Plugin - Start your own Quora / StackOverflow / Yahoo Q&A site

It's now incredibly easy to start your own Q&A site using nothing more than WordPress - The Q&A plugin simply and brilliantly transforms any site, or page, into a perfect support or Q&A environment.
Find out more

Featured Plugin - Turn any WordPress page into a fully featured wiki!

To get a wiki up and running you used to need to install Mediawiki and toil away for days configuring it... not any more! This plugin gives you *all* the functionality you want from a wiki, in WordPress!!!
Find out more

Featured Plugin - WordPress + Google Maps = Perfect

Simply insert google maps into posts, sidebars and pages - show directions, streetview, provide image overlays and do it all from a simple button and comprehensive widget.
Find out more

Featured Plugin - Add bottom corner (or anywhere else) chat to your site

No javascript required, no third part chat engine, just fully featured chat right in your own database on your own WP sites - couldn't be easier.
Find out more

4 Responses to Daily Tip: How to Disable Comments On Older Posts to Cut Down on Spam

  1. …or you could just go to the admin panel and set the option “Automatically close comments on articles older than xx days”. Found under Settings->Discussion.

  2. Could someone please check the tab order of the comment form? Goes name -> Comment text area -> Mail -> Somewhere else -> Website

    I’ve always thought closing older posts was a silly idea but I can see why some folks would want to do that. My most commented post is over a year old and still gets comments every so often.

  3. Thanks, thats a great idea. I always wonder why is “E-mail me whenever” is default on “Anyone posts a comment”. I got around 1000 mails a day, until I learn that I can turn off mail on new comments. :) Deleting 1000 mails a day is hard work. :)

  4. Thanks for the great tip, but would you know how to do the same thing across multiple tables at the same time? I’m running wpmu and I need to know how to do this for hundreds of blogs on one site. The tables are set up with wp_(blogid)_post. I tried doing a query exactly like yours except instead I tried

    UPDATE wp_*_post SET …

    This gives me a #1064 SQL Syntax error.

    Do you know of a way to do this? It would be extremely helpful!

Click on a tab to select how you'd like to leave your comment

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe without commenting