• Resolved Ate Up With Motor

    (@ate-up-with-motor)


    I don’t need or want either remote publishing or pingbacks — I’m concerned about spam — so I’ve removed the xmlrpc.php file. However, the pingback links still appears in the site header and I want to remove it.

    I tried inserting this code into my child theme’s functions.php file:

    function remove_x_pingback($headers) {
        unset($headers['X-Pingback']);
        return $headers;
    }
    add_filter('wp_headers', 'remove_x_pingback');

    …but that didn’t do it.

    How can I get rid of the header link without hacking up the theme’s header.php file to delete it?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Moderator t-p

    (@t-p)

    Go to Admin – Settings – Discussion

    Uncheck this: Allow link notifications from other blogs (pingbacks and trackbacks.)

    Thread Starter Ate Up With Motor

    (@ate-up-with-motor)

    That was the first thing I did, but the link is still in the header. It’s being called by the parent theme’s header.php file.

    Moderator t-p

    (@t-p)

    What theme are you using?

    Thread Starter Ate Up With Motor

    (@ate-up-with-motor)

    A child theme based on Frontier.

    Moderator bcworkz

    (@bcworkz)

    You could filter ‘bloginfo’ and change any ‘pingback_url’ values to a 403 page or something, but the meta link will still be there. The only way to get rid of that is copy headers.php to your child theme and actually remove the meta link from the template.

    Moderator t-p

    (@t-p)

    A child theme based on Frontier

    Do you have header.php in your child theme? yes? Try removing the link in there.

    Thread Starter Ate Up With Motor

    (@ate-up-with-motor)

    I talked to the theme developer, who offered this:

    function remove_pingback_url( $output, $show ) {
        if ( $show == 'pingback_url' ) $output = '';
        return $output;
    }
    add_filter( 'bloginfo_url', 'remove_pingback_url', 10, 2 );

    This doesn’t remove the link, but clears the URL from the href, so it appears as

    <link rel="pingpack" href="">

    That’s probably close enough.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Remove pingback link from header?’ is closed to new replies.