WordPress.org

Forums

Frontier
[resolved] Removing pingback URL (3 posts)

  1. Ate Up With Motor
    Member
    Posted 1 year ago #

    Hi,

    Is there a way to remove the pingback link from the header without adding a duplicate header.php file in the child theme? I don't use pingbacks and have actually deleted xmlrpc.php (I'm having suspicious users trying to hit it directly, and I know in the past people have figured out ways to exploit it), so the link isn't actually pointing to anything anyway.

    I tried adding this code to functions.php:

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

    ...but the link is still there, so that wasn't it. Any suggestions?

    Thanks!

  2. ronangelo
    Member
    Theme Author

    Posted 1 year ago #

    Is there a way to remove the pingback link from the header without adding a duplicate header.php file in the child theme?

    There's a setting for disabling pingbacks on Dashboard -> Settings -> Discussion. Doesn't that work for you?

    so the link isn't actually pointing to anything anyway.

    If it's not pointing to any file, how is it affecting your site?

    Anyway, this should remove the pingback url on the head.

    function remove_pingback_url( $output, $show ) {
        if ( $show == 'pingback_url' ) $output = '';
        return $output;
    }
    add_filter( 'bloginfo_url', 'remove_pingback_url', 10, 2 );
  3. Ate Up With Motor
    Member
    Posted 1 year ago #

    Okay, that took the URL out (the link is still there, but that filter leaves the href empty).

    It wasn't affecting the site directly, since I removed the xmlrpc file, but I didn't want to have a link in the header pointing to a nonexistent file.

    Thanks again! I really appreciate your help.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic