Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

There is the option to turn off trackbacks/pingbacks under Settings > Discussion.

But I'd like remove the X-Pingback header WordPress sends and completely remove the the trackback endpoint.

Is there a way to do this?

share|improve this question

1 Answer 1

up vote 8 down vote accepted
Plugin Name: [RPC] XMLRPCless Blog
Plugin URI:
Description: Disable XMLRPC advertising/functionality blog-wide.
Version: 0.0.7
Author: EarnestoDev
Author URI:
// Disable X-Pingback HTTP Header.
add_filter('wp_headers', function($headers, $wp_query){
        // Drop X-Pingback
    return $headers;
}, 11, 2);
// Disable XMLRPC by hijacking and blocking the option.
add_filter('pre_option_enable_xmlrpc', function($state){
    return '0'; // return $state; // To leave XMLRPC intact and drop just Pingback
// Remove rsd_link from filters (<link rel="EditURI" />).
add_action('wp', function(){
    remove_action('wp_head', 'rsd_link');
}, 9);
// Hijack pingback_url for get_bloginfo (<link rel="pingback" />).
add_filter('bloginfo_url', function($output, $property){
    return ($property == 'pingback_url') ? null : $output;
}, 11, 2);
// Just disable functionality while leaving XMLRPC intact?
add_action('xmlrpc_call', function($method){
    if($method != '') return;
        'Pingback functionality is disabled on this Blog.',
        'Pingback Disabled!',
        array('response' => 403)

Use this for a plugin in /wp-content/plugins or /wp-content/mu-plugins (for auto-activation). Or functions.php.

Funny thing is I sell a WordPress Remote Publishing Library and gave you the code to disable XMLRPC :) Bad for reputation.

share|improve this answer
return '0' is not going to work as you expect. The string '0' will return true. add_filter( 'pre_option_enable_xmlrpc', '__return_false' ); –  chrisguitarguy Oct 24 '11 at 15:47
var_dump((bool)'0'); –  EarnestoDev Oct 24 '11 at 15:51
See get_option and how pre_option_* hijacking works. If you __return_false ... it's ignored and processing is resumed as usual. You must not returned anything === false. See the code. –  EarnestoDev Oct 24 '11 at 15:54
Thanks for the help. Added one more thing to disable the rewrite rules: –  chrisguitarguy Oct 24 '11 at 16:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.