WordPress Tip: Disable Self Pingbacks

Blue Wordpress Logo Thumbnail with Pingbacks

Pingbacks are designed to be an easy way for you to receive notification when another blog or web site links to one of your posts. This can be a useful way to find out who’s linking to you without having to dig into your logs or tracking software. By default, WordPress is setup to send pingbacks to itself any time you link to one of your own posts internally. Many people, myself included, don’t find this “feature” useful and want to stop WordPress site from pinging itself. In this brief article I’ll show you a couple of easy ways to turn off self pingbacks.

Turn off Self Pingbacks in Functions.php

The way I disable pings to my own sites is to add a few simple lines of code to my functions.php file. This way is simple, effective, and I like being able to see the exact code I’m adding to my WordPress install (which you don’t always know if you just activate a plugin). Before making any changes, make sure to backup your site and functions.php file. Now, open your functions.php file and enter the following code:

// Disable pings to self
function no_self_ping( &$links ) {
    $home = get_option( 'home' );
    foreach ( $links as $l => $link )
        if ( 0 === strpos( $link, $home ) )
add_action( 'pre_ping', 'no_self_ping' );

Save the file (and upload if necessary). Self pingbacks are now disabled! (Thanks to the folks on the WordPress.org forums for this code).

Disable Self Pingbacks with “No Self Ping” Plugin

If you don’t feel like adding any code to your functions.php file, another easy way to turn off pings to your own posts is to use a plugin. A simple WordPress plugin that will do the trick is No Self Ping. Just install this plugin and activate it. That’s all you need to do to disable self pings using the No Self Ping plugin. Normally, I’d include a couple other similar plugins for you to choose between but its not really necessary for this article. No Self Ping is a pretty simple plugin and it works well (it has a solid 5 star rating on WordPress.org). If you want to turn off self pings with a plugin, use No Self Ping.

Avoid Self Pinging by Using Relative Links

Another option some people use to avoid self pinging is to use relative paths for the links in their posts instead of absolute paths. In other words, they use:
<a href="/wordpress/2011/06/26/post-title">Link Using Relative Path</a>

instead of:

<a href="http://www.mysite.com/wordpress/2011/06/26/post-title">Link Using Absolute Path</a>

While this method does work, I don’t recommend it as a solution to this self pinging issue. I like using absolute paths, and this seems like making a big change in how I write my posts just to fix a tiny issue. Not to mention that it’s something that can easily be fixed with a few lines of code or by activating a plugin. At the same time, I decided to at least mention this method since I’ve seen it talked about over on the forums.


It’s really quite easy to disable self pingbacks in WordPress if it’s something you want to do. My recommendation is to either add the lines of code above to your functions.php file or to install and activate the No Self Ping plugin. By doing one of these things you’ll prevent your WordPress site from pinging itself in the future.

What method above do you use on your WordPress site? Or, if you like self ping feature and keep it active on your site, I’d be interested to hear your thoughts on how this feature is useful for you. Let me know in the comments below…

About the Author: Dana Duncan

Hi, my name is Dana, and I've been building websites for over 12 years. It's a topic I'm passionate about and enjoy teaching. Here at All Webmaster.com I teach people how to create and run websites, and show businesses how to build or improve their web presence.

Leave a comment

Welcome to All Webmaster!

Dana Duncan About Picture

Hi, my name is Dana and here at All Webmaster I teach people how to build websites. I've been creating websites professionally for over 12 years and this is where I'll share the things I've learned so you can build your own website and get people to visit it. [More about...]

Like Us on Facebook: