Remove WordPress Pingback Emails From Your Own Domain

Written by James Parsons James Parsons, updated on 08/07/2025 0 Comments

I'm not entirely sure why this isn't native functionality, but if you internally link to your own posts, you'll get emails when those posts go live. Here's an example from another business I own:

Pingbacks

Thankfully you can disable this for your own domain only. After all, you don't really need to be notified each time you add an internal link... right?

Just drop this at the bottom of your functions.php file to solve this issue:

/**
 * Disable self-pingbacks (pingbacks from your own domain)
 */

function disable_self_pingbacks(&$links) {
    $home_url = get_option('siteurl');
    
    $parsed_home = parse_url($home_url);
    $home_domain = isset($parsed_home['host']) ? $parsed_home['host'] : '';
    
    $home_domain = preg_replace('/^www\./', '', $home_domain);
    
    foreach ($links as $key => $link) {
        $parsed_link = parse_url($link);
        $link_domain = isset($parsed_link['host']) ? $parsed_link['host'] : '';
        
        $link_domain = preg_replace('/^www\./', '', $link_domain);
        
        if ($home_domain == $link_domain) {
            unset($links[$key]);
        }
    }
}
add_action('pre_ping', 'disable_self_pingbacks');

// XML RPC

function block_self_pingback_xmlrpc($source_uri) {
    $home_url = get_option('siteurl');
    
    $parsed_home = parse_url($home_url);
    $parsed_source = parse_url($source_uri);
    
    $home_domain = isset($parsed_home['host']) ? $parsed_home['host'] : '';
    $source_domain = isset($parsed_source['host']) ? $parsed_source['host'] : '';
    
    $home_domain = preg_replace('/^www\./', '', $home_domain);
    $source_domain = preg_replace('/^www\./', '', $source_domain);
    
    if ($home_domain == $source_domain) {
        return false;
    }
    
    return $source_uri;
}
add_filter('xmlrpc_pingback_source_uri', 'block_self_pingback_xmlrpc');

// Prevent pingback emails from being sent about internal links on my own domain

function disable_self_pingback_emails($notify, $comment_id) {
    $comment = get_comment($comment_id);
    
    if ($comment && in_array($comment->comment_type, array('pingback', 'trackback'))) {
        $source_url = $comment->comment_author_url;
        
        $home_url = get_option('siteurl');
        
        $parsed_home = parse_url($home_url);
        $parsed_source = parse_url($source_url);
        
        $home_domain = isset($parsed_home['host']) ? $parsed_home['host'] : '';
        $source_domain = isset($parsed_source['host']) ? $parsed_source['host'] : '';
        
        $home_domain = preg_replace('/^www\./', '', $home_domain);
        $source_domain = preg_replace('/^www\./', '', $source_domain);
        
        if ($home_domain == $source_domain) {
            return false;
        }
    }
    
    return $notify;
}
add_filter('notify_post_author', 'disable_self_pingback_emails', 10, 2);

function remove_pingback_header() {
    if (isset($_SERVER['HTTP_X_PINGBACK'])) {
        unset($_SERVER['HTTP_X_PINGBACK']);
    }
}
add_action('init', 'remove_pingback_header');

remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');

Did this help? Please let me know in the comments!

Related Code Snippets

Written by James Parsons

Hi, I'm James Parsons! I founded Content Powered, a content marketing agency where I partner with businesses to help them grow through strategic content. With nearly twenty years of SEO and content marketing experience, I've had the joy of helping companies connect with their audiences in meaningful ways. I started my journey by building and growing several successful eCommerce companies solely through content marketing, and I love to share what I've learned along the way. You'll find my thoughts and insights in publications like Search Engine Watch, Search Engine Journal, Forbes, Entrepreneur, and Inc, among others. I've been fortunate to work with wonderful clients ranging from growing businesses to Fortune 500 companies like eBay and Expedia, and helping them shape their content strategies. My focus is on creating optimized content that resonates and converts. I'd love to connect – the best way to contact me is by scheduling a call or by email.