Self Pings: What are they and do you need to turn them off?

What is a Ping/Pingback?

By default, WordPress enables the ability to perform pingbacks. Basically, when another site references yours, you’ll be sent a “pingback” – a confirmation that this has happened, which is logged on your site similar to a post comment.

Read more about Pingbacks.

Can I turn them off?

Yes, you can. In WP Admin, head into Settings -> Discussion -> Default post settings. Untick the box marked Allow link notifications from other blogs (pingbacks and trackbacks) on new posts. Click the “Save Changes” button and you’re all done.

Note, however, that this only works for any new posts and not existing. For those, you have to go into the post and, assuming you’re using the block editor, click on the Post tab in the right-hand sidebar, scroll down to the Discussion section and untick Allow pingbacks & trackbacks before updating.

To do this en-masse you’ll need to look for a plugin or be handy with WP-CLI.

What are self pings?

Self pings are when you link to a page on your site and receive a pingback for it. They can be a nuisance and, let’s be honest, aren’t needed.

You can turn them off with a simple script. The following code, for example, will do just that if added to functions.php

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' );

The downside is the sheer simplicity of this solution…

  1. It runs before pings are sent out
  2. It goes through the intended pings and looks to see if they’re referring to the current site. This is based on what’s been defined in the site settings as the Home URL
  3. If the URL is this site, the ping is removed

Sounds good, yes? But this doesn’t take into account any SSL changes. If your site has old content referring to the non-SSL URL of your site, this won’t work. In addition, if you change your site URL at all at any point, it won’t take that into account.

It’s been raised as something that needs changing in WordPress Core but they’ve said a firm “no”. “Pings should simply work” and, most importantly, “there’s already a plugin for it”.

That plugin is No Self Pings.

The No Self Pings Plugin

No Self Pings, available for free and with no premium upsell, will turn off all the self pings as well as additional features on top.

For example, will allow you to add additional URLs into the mix. These can be non-SSL version of your site URL, old URLs or even the URLs of other sites you own that you may not want self-pings for.

Here’s how it looks in the Settings…

In future, I intend to update this so that SSL doesn’t even need to be taken into account – both SSL and non-SSL versions of the current or any other site mentioned in the above settings will be considered.

A quick history of the No Self Pings plugin

No Self Pings was written by Michael D. Adams, aka mdawaffe, 17 years ago. However, after 2 updates, development stopped.

I was a user of the plugin myself and, 5 years ago, with SSL issues being reported, I forked the plugin to fix the issues myself. I approached Michael to ask if I could take it over, which he kindly agreed to.

Talk to me!

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: