Easy Guide to Disable Self Pingbacks in WordPress

In this tutorial, we will learn how to disable self pingbacks in WordPress.

What is a Pingback?

Pingbacks give softwares the ability to communicate between websites. Its almost like remote comments. Think of it like this:

  • We write a post on WPCademy blog.
  • Then you write a post on your blog mentioning/linking to our article.
  • Your blogging software (WordPress) will automatically send us a pingback.
  • Our blogging software (WordPresS) will receive the ping. It will then automatically go to your blog to confirm that the pingback originates there (check if the link is present).
  • Then we will have the ability to display your pingback as a comment on our post. This will solely be a link to your site.

Pingbacks also work within your site. So if one of your posts link to another post, then your WordPress will send a self-ping. This can get really annoying.

Self Pingbacks on a WordPress site

Fore more details, take a look at our guide about trackbacks and pingbacks.

Now that you know what is a pingback, let’s take a look at how to disable self pingbacks.

There are multiple ways you can disable self pingbacks on your WordPress site. We will show you both plugin method and manual code method.

Disable Self Pingbacks in WordPress Using Plugins

There are two plugins that you can use to turn off self pings.

1. Using No Self Pings Plugin

First thing you need to do is install and activate the No Self Pings plugin. The plugin works out of the box, and there are no settings for you to configure. Simply activating the plugin will turn off self pingbacks.

You will notice that No Self Pings plugin hasn’t been updated for more than two years. Usually we do not recommend installing plugins that haven’t been updated this long. Simply because in most cases those plugins do not work. However, No Self Pings is very simple plugin, and it works even with the latest version of WordPress (4.2.3 At the time of writing this article).

We recommend you to read our guide on the issue of installing plugins not tested with your WordPress version.

2. Using Disabler Plugin

Simply install and activate the Disabler plugin. Upon activation, visit Settings » Disabler page to configure the plugin.

Disabler plugin settings page

You will notice that the plugin allows you to turn off several WordPress features. You need to scroll down to Back End Settings section and check the box next to Disable self pings option.

Click on the save changes button to store your settings.

Turn Off Self Pings Without Using a Plugin

If you do not want to use a plugin, then you can use these two methods to turn off self pings on your site.

1. Turn off Pingbacks Globally

WordPress allows you to turn off pingbacks on your site. By using this option will disable pingback feature completely on your site.

Simply go to Settings » Discussion page. Under the Default article settingssection, uncheck the box next to ‘Attempt to notify any blogs linked to from the article’ option. Click on the save changes button to store your settings.

Disable all outgoing pinbacks from your site

2. Manually Insert Code to Disable Self Pingbacks

If you are comfortable with adding code snippets to your WordPress theme files, then you can use this method to switch off self pings.

Simply copy and paste this code in your theme’s functions.php file or a site-specific plugin.

function no_self_ping( &$links ) {
    $home = get_option( 'home' );
    foreach ( $links as $l => $link )
        if ( 0 === strpos( $link, $home ) )
            unset($links[$l]);
}
 
add_action( 'pre_ping', 'no_self_ping' );

That’s all, we hope this tutorial helped you disable self pings on your WordPress site.