How To Crush WordPress Trackback Spam
Since upgrading to WordPress 2.3.2, the webserver that hosts my blog has taken a beating from trackback spammers.
The trackback requests were prevalent before, but for some reason they weren’t slowing the server down until the upgrade.
After trying many solutions, I finally found a way to solve the problem. This will no longer allow you to have trackbacks on your blog, but if you have to decide between no blog or no trackbacks then I’m sure you’ll have no problem implementing this.
Basically you just update your index.php to the following:
if ( preg_match('/trackback/', $_SERVER['REQUEST_URI']) ) {
die();
} else {
/* Short and sweet */
define('WP_USE_THEMES', true);
require('./wp-blog-header.php');
}
?>
You might need to modify the preg_match() so that you don’t cut off legit posts that have trackback in the name, but the blog I use this code on does not have such posts.
Hopefully some day soon these spammers will realize they’re doing no one any good.
If you enjoyed this post, get free updates by email or RSS.

























Checkout These Related Posts
33 Comments so far »
Joey Logano Fan said
on May 2 2009 @ 9:12 pm
Just what I’ve been looking for
Hotels in Las Vegas said
on June 3 2009 @ 2:10 pm
I’ve been receiving tons of comment-spam on my movable type blogs. should the trackback feature be kept on or off?
Joey Logano Fan said
on June 5 2009 @ 10:46 pm
Just one other note… I wish wordpress took care of this on their own end, hehe.
hussy engineering said
on June 30 2009 @ 7:43 am
Trackback is a method for Web authors to request notification when somebody links to one of their blog entries. It shown as a content containing snippet of content of the blog entry with a link to another web page as the author.
Furniture said
on August 20 2009 @ 4:23 am
Very useful code, very good solution, thanks for taking time to publish it.
generic said
on August 28 2009 @ 2:23 pm
I’ve also been receiving tons of comment-spam on my movable type blogs. should the trackback feature be kept on or off?
used tires said
on September 1 2009 @ 6:23 pm
@Generic perhaps you should have it so that the trackbracks are on approval status, that way you can differentiate form the spam vs real trackbacks to your website.
Till then,
Jean
Buy PSP Go said
on September 5 2009 @ 9:37 am
Thanks for this, I just have them on ‘moderate’ mode meaning I’ve got to take a look at them before they’ll show.
Damon Day said
on September 14 2009 @ 2:30 am
Ya, I just have them on approval status so I can send them to akismet when they come in. Hopefully that will help knock them out for others that use that plugin
Wayene said
on September 18 2009 @ 11:11 pm
Thanks for the tutorial,this simple code is very handy to protect trackback spam, I run a google trend based site and daily gets trackback spam
ATV for Sale said
on September 23 2009 @ 6:49 pm
I really hate how much trackbacks clutter post comments. Thanks for supplying this workaround.
Love Graphics said
on September 30 2009 @ 8:48 pm
What exactly are track backs even for? Can’t we just disable them in Wordpress settings?
PSP Go said
on October 3 2009 @ 7:46 pm
Great, this is very helpful stuff. The technical side of things sometimes gets me.
Damon Day said
on October 6 2009 @ 5:28 pm
Hey Ryan, you ever coming back to your blog?
Jessica Web Design Tips said
on November 1 2009 @ 4:45 pm
I am building a WordPress blog and when I make a new page it shows a link that says “trackback URI” at the bottom of the pages.
car said
on November 6 2009 @ 11:23 am
Why you dont like track back?
its works for me!
Metal Briefcases said
on November 16 2009 @ 6:23 pm
Personally I think trackbacks should be kept hidden to everyone but the blog owner. Other people simply are not interested.
PSP Go said
on November 17 2009 @ 3:28 pm
Since this post I have been able to reduce the amount of spam comments clogging up my page.
ATV for Sale said
on November 19 2009 @ 4:57 pm
Yes blow owners need to learn to keep their blogs more clutter-free. Trackback spam is a perfect example of the kind of clutter that can be eliminated.
vektörel said
on December 18 2009 @ 11:41 pm
Very useful code, very good solution, thanks for taking time to publish it.
Antalya Turkey said
on December 25 2009 @ 1:21 am
Hey thats vey cool. My websites is http://www.07il.com its about antalya turkey guide.
tattoo kits said
on January 3 2010 @ 1:57 pm
Thanks for this advice - I will apply this to my Wordpress blogs!
Evden eve nakliye said
on January 17 2010 @ 9:34 am
It shown as a content containing snippet of content of the blog entry with a link to another web page as the author.
Scrap Gold said
on January 20 2010 @ 8:56 am
This code works.thanks.
Laptop Briefcases said
on January 20 2010 @ 6:51 pm
I personally dislike how comments section often turn into a flood of trackback links. Obviously people take advantage of that feature and use trackbacks as a link building strategy.
Boxing Bags said
on January 24 2010 @ 12:39 pm
great advice - many thanks
oyun said
on January 26 2010 @ 11:33 am
I have been able to reduce the amount of spam comments clogging up my page..
oyun said
on January 26 2010 @ 11:36 am
and very good solution, thanks for taking time to publish it.
Xbox 360 cheat said
on January 28 2010 @ 6:41 am
It shown as a content containing snippet of content of the blog entry with a link to another web page as the author.
Jessica Web Design Tips said
on March 5 2010 @ 6:55 am
If you keep receiving spam, you should turn it off. If you have the option to turn off anonymous comments, turn that off too - so only registered people can post comments.
Jessica Web Design Tips said
on March 5 2010 @ 6:56 am
This will help them sort the problem out, and in future you’ll be able to enable trackbacks once again.
Jessica Web Design Tips said
on March 5 2010 @ 6:56 am
Ping estimates the round-trip time, generally in milliseconds, and records any packet loss, and prints a statistical summary when finished.
used tires said
on March 6 2010 @ 12:34 pm
I don’t see anything regarding that in the blog..
Till then,
Jean
Comment RSS · TrackBack URI
Leave a comment
Pingbacks/Trackbacks