April 30, 2013

Disable Pingback Spam

Disable Pingback Spam

For those of you that have just recently installed WordPress and begun blogging or have an existing blog that is picking up speed, you may notice an inflated amount of spam in your comments due to fraudulent trackbacks sent by people just trying to get a link from your site.

If you are as annoyed by this as I was today, I’ve found the solution that you should use to take care of the problem. Since I don’t like using plugins for a simple problem that can be fixed manually, here is my method you should consider using.

In your web hosting control panel (cPanel, Plesk, Webmin, or whatever CP you have), make a full backup then go to PHPMyAdmin and run the following SQL command on your database:

UPDATE wp_posts SET ping_status='closed' WHERE post_status = 'publish' AND post_type = 'post';
UPDATE wp_posts SET ping_status='closed' WHERE post_status = 'publish' AND post_type = 'page';

If you have custom post types installed on your WordPress, then you’ll also need to run this on your CPT  posts:

UPDATE wp_posts SET ping_status='closed' WHERE post_status = 'publish' AND post_type = 'yourcptnamehere';

PHPMyAdmin WordPressThis will disable trackback spam on all of your posts and pages on your website without you having to go under each post and page and manually update which can be quite the chore. The SQL command is run under the SQL tab on the very top of your PHPMyAdmin after going under your WordPress database.

If you changed the default table string when setting up WordPress, you’ll need to change wp_ to whatever you changed the table string to. For most, wp_posts is correct. On the left of this post, I attached a screenshot of PHPMyAdmin with wp_ highlighted so that you can make sure you are using the right UPDATE setting when you run the UPDATE SQL command.

If you have something besides wp_posts, like wordpress_posts, then you’ll run the following command instead:

UPDATE wordpress_posts SET ping_status='closed' WHERE post_status = 'publish' AND post_type = 'post';
UPDATE wordpress_posts SET ping_status='closed' WHERE post_status = 'publish' AND post_type = 'page';

The last step is you’ll need to disable trackbacks by default on your site for all new posts and pages you create. To do this, go to Administration > Settings > Discussion and uncheck the box “Allow link notifications from other blogs (pingbacks and trackbacks).”

Disable WordPress Trackbacks

Note to remember: Updating the discussion setting in your WordPress will not disable pingback and trackbacks to your existing posts and pages that had it enabled before you adjusted this setting. You’ll still need to update your database to disable it on all of your posts and pages.

Now you’ll have less spam in your SPAM folder to wade through when doing your periodic cleanups.

About the author 

Scott Buehler

I'm Scott Buehler and I'm here to help you choose the best web host for your needs. This site aims to be completely unbiased and is data driven for the ranking charts. Be sure to leave a review or comment below to share your experience. This site thrives off of word of mouth. Please share this site on your website, blog, or social media. Add me to your circles! Thanks!

  • Thanks man for this post.. Its really very iinteresting as I have been suffering from spam comments and unnecessary ping backs. I will implement this on my Blog asap. .but. Am confused on where to implement the code, is it inside the tab labelled wp_post as according to ur control panel? Am confused on that part.

    • Henri, that refers to PHPMyAdmin which should be available to you via your web host control panel. This isn’t something you can do from within your WordPress administrative back-end.

  • This is a great tip, needed it badly. I still seem to be getting pingbacks on media files though. Is there a filter that’s for media? Maybe something like post_type= ‘media’ or would that be too obvious?

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

    Title Goes Here

    Get this Free E-Book

    Use this bottom section to nudge your visitors.