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.
What Pingback Killer Does
- Remove the X-Pingback header WordPress sends
- Causes called to
bloginfo( 'pingback_url' )or
get_bloginfo( 'pingback_url' )to return an empty string
- Hijacks the
default_pingback_flagto return false/zero – evaluation of those boolean options will never return true
- Completely disables the
- Removes all the rewrite rules that end with
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.
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
3. Hijacking Options
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_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.
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.
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
Keeping it Simple
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.