WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Remove pingback link from header? (8 posts)

  1. Ate Up With Motor
    Member
    Posted 8 months ago #

    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?

  2. Tara
    Member
    Posted 8 months ago #

    Go to Admin - Settings - Discussion

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

  3. Ate Up With Motor
    Member
    Posted 8 months ago #

    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.

  4. Tara
    Member
    Posted 8 months ago #

    What theme are you using?

  5. Ate Up With Motor
    Member
    Posted 8 months ago #

    A child theme based on Frontier.

  6. bcworkz
    Member
    Posted 8 months ago #

    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.

  7. Tara
    Member
    Posted 8 months ago #

    A child theme based on Frontier

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

  8. Ate Up With Motor
    Member
    Posted 8 months ago #

    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.

Reply

You must log in to post.

About this Topic