Turn off WordPress trackbacks. For good

This post was written by eli on December 13, 2011
Posted Under: Software

There are several ways to stop these pingbacks, 95% of which are spam.

My method may not be optimal, but has the elegance of simplicity. Simply edit the part in the end of wp-trackback.php (at WordPress’ root directory) going

if ( !empty($tb_url) && !empty($title) ) {
 header('Content-Type: text/xml; charset=' . get_option('blog_charset') );

 if ( !pings_open($tb_id) )
 trackback_response(1, 'Sorry, trackbacks are closed for this item.');

 $title =  wp_html_excerpt( $title, 250 ).'...';
 $excerpt = wp_html_excerpt( $excerpt, 252 ).'...';

    [ ... snipped ... ]

 trackback_response(0);
}

and turn it into

trackback_response(1, 'Sorry, trackbacks are closed for this item.');

(don’t remove the trailing “?>”)

So this gives the correct response to the client trying to send trackbacks, and doesn’t bother you anymore.

Add a Comment

required, use real name
required, will not be published
optional, your blog address