PMG Digital Made for Humans

Pingback Killer

4 MINUTE READ | October 31, 2011

Pingback Killer

Author's headshot

Christopher Davis

Christopher Davis has written this article. More details coming soon.

Pingbacks are a way for blog/web authors to learn when someone links to them. Essentially, they are an API call from one site to another. If I link to a site in a post on my WordPress blog, it will send an XML-RPC request to the linked site and a pingback is created.

The thing about pingbacks is they suck.

Most often ping backs are used for spam: they’re a way for a spammer to get links in your comment section by linking to your site. They don’t even have to build a bot to go submit comments, just put a link in their posts.

I dislike pingbacks so much that I decided to kill them with a brand new WordPress plugin, Pingback Killer.

Pingback Killer was originally built for a client, but we decided to release it so other folks could benefit from it.

  • Remove the X-Pingback header WordPress sends

  • Causes called to

    loginfo( 'pingback_url' ) or get_bloginfo( 'pingback_url' ) to return an empty string

  • Hijacks the default_ping_status and default_pingback_flag to return false/zero – evaluation of those boolean options will never return true

  • Completely disables the XML-RPC call

  • Removes all the rewrite rules that end with /trackback/

Read on to find out how Pingback Killer does all this, or you can simply download and install the plugin from the WordPress repository.

1. Removing the X-Pingback Header

You can filter the headers WordPress sends with the wp_headers filter hook. Pingback Killer does this.


add_filter( ‘wp_headers’, ‘pmg_pk_filter_headers’, 10, 1 );
function pmg_pk_filter_headers( $headers )
    if( isset( $headers[‘X-Pingback’] ) )
        unset( $headers[‘X-Pingback’] );
    return $headers;

2. Taking bloginfo( ‘pingback_url’ ) off the table

Like almost every WordPress core fuction, get_bloginfo comes with a filter hook. In this case, it’s bloginfo_url.


&lt;?php<br /><br />
add_filter( ‘bloginfo_url’, ‘pmg_pk_kill_pingback_url’, 10, 2 );<br /><br />
function pmg_pk_kill_pingback_url( $output, $show )<br /><br />
{<br /><br />
	if( $show == ‘pingback_url’ )<br /><br />
	{<br /><br />
		$output = ”;<br /><br />
	}<br /><br />
	return $output;<br /><br />

3. Hijacking Options

get_option and update_option both come with hooks to control what gets saved for an option or gets sent back. You can use those hooks to filter the content. __return_false and __return_zero are both WordPress core functions that do exactly what their names say: return false and 0 respectively. They’re useful for disabling things, just like we’re doing here.


add_filter( ‘pre_update_default_ping_status’, ‘__return_false’ );
add_filter( ‘pre_option_default_ping_status’, ‘__return_zero’ );
add_filter( ‘pre_update_default_pingback_flag’, ‘__return_false’ );
add_filter( ‘pre_option_default_pingback_flag’, ‘__return_zero’ );

4. No More XML-RPC

Every XML-RPC callback function has an action hook called xmlrpc_call. You can hook into it and stop WordPress from continuing by calling wp_die if the XML-RPC server is processing a pingback.


add_action( ‘xmlrpc_call’, ‘pmg_pk_kill_xmlrpc’ );
function pmg_pk_kill_xmlrpc( $action )
    if( ‘’ === $action )
            __( ‘Pingbacks are not supported’ ),
            __( ‘Not Allowed!’ ),
            array( ‘response’ => 403 )

5. Cleaning Up Rewrite Rules

Rewrite rules are filtered only when they get rebuilt (doesn’t happen often). But when it does happen, you can hook into rewrite_rules_array and filter out anything that ends with trackback.


add_filter( ‘rewrite_rules_array’, ‘pmg_pk_filter_rewrites’ );
function pmg_pk_filter_rewrites( $rules )
    foreach( $rules as $rule => $rewrite )
        if( preg_match( ‘/trackback/?$$/i’, $rule ) )
            unset( $rules[$rule] );
    return $rules;

Stay in touch

Bringing news to you

Subscribe to our newsletter

By clicking and subscribing, you agree to our Terms of Service and Privacy Policy

Pingback Killer is a very simple plugin. There are no options pages. Just install it, turn it on, and enjoy the lack of spam pingbacks. We already have this in use on several client blogs and this one.

Related Content

thumbnail image

AlliPMG CultureCampaigns & Client WorkCompany NewsDigital MarketingData & Technology

PMG Innovation Challenge Inspires New Alli Technology Solutions

4 MINUTES READ | November 2, 2021

thumbnail image

Applying Function Options to Domain Entities in Go

11 MINUTES READ | October 21, 2019

thumbnail image

My Experience Teaching Through Jupyter Notebooks

4 MINUTES READ | September 21, 2019

thumbnail image

Working with an Automation Mindset

5 MINUTES READ | August 22, 2019

thumbnail image

3 Tips for Showing Value in the Tech You Build

5 MINUTES READ | April 24, 2019

thumbnail image

Testing React

13 MINUTES READ | March 12, 2019

thumbnail image

A Beginner’s Experience with Terraform

4 MINUTES READ | December 20, 2018