KNOWNHOST WIKI

User Tools

Site Tools


resources:what-are-self-pings

What are Self-Pings?

The beauty of WordPress is that it’s so smart, it even detects when you link from one post of yours to another.  Remember, it’s the LINK that triggers the self-ping in Wordpress.

If one blog post were to mention another by linking to it, you’d find a link like this somewhere on the page:  1)Web Hosting Explained for Beginners

It could also be the case the the link is anchored with text, like 2)Web Hosting Explained


Self-Ping Example:

Site #1: Publishes a remarkable post (post ‘a’) about the secrets of the universe.

Site #1: 6 months later publishes another post (post ‘b’) about the universe and links to post ‘a’.

Site #1:

  • Post ‘a’ receives the pingback notification and WordPress checks post ‘b’ to confirm it did in fact link to post ‘a’.
  • The site owner now needs to approve it, just like a comment, on post ‘a’ so it will appear in the comments section.


What is Wrong with Self-Pings?

If you’re savvy with search engine optimization, you’ll likely be linking to one or more of your other posts with each new post published on the site.  This is done to inflate the importance of the other posts, helping improve their search engine rankings, which in turn will bring you in more traffic. Also, linking externally is a way of pulling back Trust Flow to your site (a factor that’s part of search engine ranking algorithm).

For more information about how to use internal and external links to improve your search engine rankings and traffic, read more on the 3)KnownHost blog.

Imagine every time you use the word ‘me’ or ‘I’ in a sentence, a very annoying friend stands next to you ringing a cowbell in your ear.  This is just what’s going to happen as you interlink posts in WordPress. The more you link, the more self-pings you receive. This quickly will become very annoying and difficult to manage.

For more information on how to 4)link externally, and how to blog to grow organic search traffic, check out the KnownHost blog: 5)Blogging Grow Search Traffic


How to Stop Self-Pings?

There are several methods of stopping self-pings:

  1. Disable sending pingbacks altogether
    • This is a bit like using a sledgehammer as a flyswatter.  By disabling sending pingbacks, you will no longer send notifications to your site or other sites when you link to posts.  See below section on how to disable sending pingbacks.
    • Advantage: Yes, indeed, self-pings will stop.
    • Disadvantage: You’ve completely stopped sending pingbacks.
  2. Stop using full URL’s
    • Unordered List ItemInstead of linking using: 6)Web Hosting Explained for Beginners
    • Unordered List ItemYou could link using: /blog/web-hosting-explained-for-beginners/
    • Unordered List ItemThe advantage of using this approach is that it requires no added plugins.
    • Unordered List ItemThe disadvantages include:
      • Links can’t be copied and shared by others without modification.
      • Depending on where you are when you link, and whether or not you remember the leading “/”, the url could become broken and give a 404 error.
  3. Use a plugin
    • It’s much simpler to just add a lightweight plugin, such as: No Self Pings - 7)No Self Ping
    • Alternatively, using a multi-features plugin which disables self pings Disabler -8)Plugins Disabler
      • Note: At the time of publishing this page, both plugins were somewhat outdated and could possibly not be compatible with, or not be secure when using, a newer version of WordPress.
      • Advantage: Either approach can definitely stop self-pings.
      • Disadvantage: You’re adding more plugin overhead weight that needs to be regularly updated or else there’s potential vulnerabilities and compromises that become available to hackers.
  4. Manually code a change in your functions.php or theme files


*WARNING - THIS IS ADVANCED - YOU CAN EASILY BREAK WORDPRESS*

*EDITING FUNCTIONS.PHP MANUALLY CAN RESULT IN CRASHES*


How it Works

The idea behind the manual approach is that you’re going to create a function that’s triggered before pingbacks are sent.  It will strip the links out of any pingbacks before anything is sent.

Set up the function:

  function disable_selfpinging( &$selfpinglinks ) {

Get your blog URL from available options:

      $mysite = get_option( ‘home’ );

Loop through all the links:

      foreach ( $selfpinglinks as $spl => $selfpinglink )

Check to see if the link points to your site:

      if ( 0 === strpos( $selfpinglink, $mysite) )

Strip the link if it does:

        unset($selfpinglinks[$spl]);

End the loop checking:

    }

Set the hook action:

    add_action( ‘pre_ping’, ‘disable_selfpinging’ );

Full Version of the no self pinging code:

  function disable_selfpinging( &$selfpinglinks ) {
  $mysite = get_option( ‘home’ );
  foreach ( $selfpinglinks as $spl => $selfpinglink )
      if ( 0 === strpos( $selfpinglink, $mysite) )
          unset($selfpinglinks[$spl]);
  }
  add_action( ‘pre_ping’, ‘disable_selfpinging’ );


Usage notes:

If you’re using the default theme, edit the functions.php file and then get the theme updated, your changes will be overwritten and gone.

If you’re using the default theme, then change to a different theme, your changes will no longer be present.

Best practices call for themes to be regularly used and updated, so you should put your changes into a child theme so that they are preserved, even when the main theme gets updated.

If you make an error in rekeying the above, omit a bit of punctuation during a copy and paste, or generally make any kind of fat fingering error at all, you can bet that there will be some type of error or crash generated as a result.

Advantage:  You’ll have self-pings turned off, while still keeping regular pingbacks.

Disadvantages:  See above notes.

As you can see, if you’re an advanced WordPress user, then manual changes could be a good solution.  It’s not recommended for novices!

Check out the offers and to find out about fully managed WordPress hosting with KnownHost: 9)Managed Wordpress Hosting

resources/what-are-self-pings.txt · Last modified: 2020/10/20 14:37 by Karson N.