WordPress Trackback Spam Killer

I’ve been getting hammered with trackback spam. I have my blacklist setup to weed out anything that comes from our good friends, the “texas hold em / online poker” folks. However, this just puts the trackback spam into the moderation queue. That means I have to clean it out ever so often. I’m lazy, so that rarely happens. To get around this, I wrote a modification to the WordPress wp-trackback.php file to search for these spammers and nix their attempts at making me do work.

I created a new file called ‘wp-trackback_spamkiller.php’ that contained the following code. You can add whatever words you would like to be blacklisted in the $blacklist array.

function trackbackSpamKiller($message){
    # add to this to get rid of trackback spam containing these words
    $blacklist = array(
        'online casino',
        'texas hold',
        'online poker',
        'virtual strip poker'
    foreach($blacklist as $key=> $val){
        # if it's in there... kill the attempt
            die("Please don't spam me.");

After you have created that file and uploaded it to the same folder as your ‘wp-trackback.php’ file you will need to make a call to the function in the ‘wp-trackback.php’ file. Download the ‘wp-trackback.php’ file and find the line that reads:

require(dirname(__FILE__) . '/wp-config.php');

Directly under that line, insert the following line:


This will allow the trackback file to call the function that we created earlier. Now you need to actually call the function so that the test can be performed. Find the line in your ‘wp-trackback.php’ file that reads:

$blog_name = $_POST['blog_name'];

Immediately after that line, paste these lines:


Now, save the ‘wp-trackback.php’ file and upload it to the server. Your trackback spam should no longer appear in the moderation queue. I’ll probably refine this in the future but for now, it works. Of course, caveat emptor.

UPDATE: I changed the formatting a little and made some changes to the blacklist array. I’m looking into allowing the blacklist array to be pulled from the moderation queue list. That way you can use the same blacklist rather than maintaining two lists. –Axs (3:15pm 2005-02-23)

This entry was posted in General, Web Design. Bookmark the permalink.

4 Responses to WordPress Trackback Spam Killer

  1. Pingback: Bridgey Speaks » Trackback Spam Killer

  2. Pingback: knomat.

  3. Pingback: popnutten

  4. Pingback: η‹—ηˆΊθͺžιŒ„ » Crusade against trackback spam

Leave a Reply

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