Support » Fixing WordPress » Disabling Pingbacks/Trackbacks on Pages

  • I’ve been getting a lot of trackback spam lately on my site, but it’s all been through PAGES instead of POSTS.

    I’ve got trackbacks disabled globally for posts for a while, but I haven’t figured out a way to disable trackbacks on PAGES.

    A few support places have suggested disabling them through this SQL query:

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

    . . . but I wanted to know if there were any other options out there.

    Thanks!

Viewing 15 replies - 1 through 15 (of 16 total)
  • You can disable comments on pages by going to wp-admin / pages / all pages, and clicking quick edit (instead of edit). There, you can disable comments for the page.

    Have you gone to wp-admin / settings / discussion … and disabled trackbacks and pingbacks there?

    Or try this plugin … for eliminating self-trackbacks.

    Or try putting this php file in your mu-plugins or plugins folder:

    <?php
    // Disable X-Pingback HTTP Header.
    add_filter('wp_headers', function($headers, $wp_query){
        if(isset($headers['X-Pingback'])){
            // Drop X-Pingback
            unset($headers['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 pingback.ping functionality while leaving XMLRPC intact?
    add_action('xmlrpc_call', function($method){
        if($method != 'pingback.ping') return;
        wp_die(
            'Pingback functionality is disabled on this Blog.',
            'Pingback Disabled!',
            array('response' => 403)
        );
    });
    ?>

    Thanks for the response!

    I’ve had trackbacks/pingbacks disabled through wp-admin/settings/discussion for a while now, but that seems to only affect posts, not pages.

    Disabling comments one-by-one seems a little impractical in my case, especially since I also seem to be getting trackbacks on attachment pages, which aren’t accessible through wp-admin/pages/all pages.

    I might try out that little mini plugin, although I’m averse to adding more plugins to my install and would rather use another method.

    Thanks again for the help!

    I’d be more adverse to altering your core WP or core theme files. You’ll have to keep a changelog handy, as everytime you update your WP or theme, you’ll lose your changes.

    Yes, too many plugins can bog things down a bit, but not a mini plugin like this. You can always use the P3 Plugin Profiler to determine which plugins are adding the most to your page load times … Jetpack and various types of lightbox plugins being some of the more notable culprits.

    Thanks for the advice, Jason. I’ll try out the plugin and see how it goes.

    Saved the script you posted as a PHP file in the plugins folder and I’m still getting a ton of trackback spam, close to or over 1,000 a day. I’m not sure if I did something wrong in saving the script, or if it’s just plain not working.

    If you saved it to your plugins folder, you’ll have to activate it. If you save it to your MU-Plugins folder (MU = must use, then it will automatically activate.

    But that script wasn’t personally tested by me. I had a friend who used it. I’ll look around for a separate solution.

    Plugin didn’t work for me. Might have been my incompetence in installing it, but I tried it in both the regular plugins directory and the mu-plugins directory.

    Still getting hundreds of instances of trackback spam every day. Not sure what else to do to stop it, other than marking pages of comments as spam every day.

    Any other help would be greatly appreciated.

    What would I do to just strip out the commenting/pingback functionality of a page template altogether? Would that solve the issue?

    I thought that there may be a place to add tracbacks to the Quick Edit list on pages. I have been getting trash and spam. I will continue to go through all of my pages and turn it off.

    jronder

    (@villas-diani)

    sunny greetings from Diani beach maryfran, I was also trying to disable it as it was rare for me to get a proper ping, all are spam most of the time. I spent some time looking up how to disable it. I found a post how to do it easy, but I am not sure if it works as I still did not have time to try.

    Hope it helps,
    July

    jronder

    (@villas-diani)

    oh, here is the link to that post

    Not sure that post is the best suggestion as call to that file will simply cause errors, yes it will fix the problem, but only temporarily.

    I suggest something a little less extreme, and something that won’t be broken the next time WordPress updates and recreates the file you deleted.

    how to disable trackbacks

    The problem is existing posts/pages don’t get updated when you select to not have trackbacks. The above link will fix that.

    sorry updated my post with a link you can use.

    jronder

    (@villas-diani)

    I do not know why but it was realy giving me a hard time to paste the link here.

    The 3rd try, here is the link: how to disable the trackbacks and ping backs

    Once again, I am not sure if it is working. I hope it helps:-)

    July

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Disabling Pingbacks/Trackbacks on Pages’ is closed to new replies.