Resources     Blog  

  1. Home
  2. WordPress Tutorials
  3. How to Stop a Self Ping in WordPress and Why You Should

How to Stop a Self Ping in WordPress and Why You Should

Most WordPress users know and understand that internal linking is good for SEO. WordPress and Google have basically told us this over time. A good internal link helps the reader relate to something that is being talked about in a specific article. However, internal linking creates the problem of a self ping in WordPress.

Granted, this is not an issue for everyone. However, many people think the pingback and trackbacks are an annoying thing to deal with in WordPress. You don’t need your website sending you notifications every time there is a self ping.

Today, I am going to show you some ways to stop a self ping in WordPress. Before that, let’s take a look at pingbacks and trackbacks.

What are Pingbacks and Trackbacks?

Simply put, pingbacks and trackbacks are a type of technology that notifies other websites when content has been published that users may find interesting. In theory, this sounds like a great way to track things and get noticed. There are actually downsides to this though, so in this article, I am going to show you how to disable and stop a self ping.

Trackbacks

Trackbacks are actually very easy to explain. A trackback is a notification that WordPress sends to an external site when you link to it in your own content. This lets the site owner know that you are referencing their content.

The site owner then has a choice whether or not they want to approve the trackback, or ping, you have sent. The link you provide will remain in-tact either way, but if the site owner approved the trackback, then an excerpt of your post and a link to your site will display in their comments area.

Pingbacks

A pingback actually has a very similar goal as a trackback. They are kind of the same, but kind of different. They were built to be a better version of a trackback that would resolve some of the problems with trackbacks.

The main difference here is that trackbacks are sent manually, while pingbacks happen automatically. Needless to say, oftentimes this is not something you want to happen all of the time.

Not only that, but self pingbacks are even more troublesome and annoying because they are being sent to you almost non-stop. If you are good at internal linking on your website, then you no doubt have a continuing stream of self pingbacks happening.

This is just one of the many problems with trackbacks and pingbacks. Let’s take a look at some options available to you for stopping a self ping in WordPress.

No Self Pings

No Self Pings Plugin

If you want to use a plugin to stop self pings, then the No Self Ping plugin for WordPress is your best option. Not only is this the fastest and easiest way to accomplish this, but it also gives you a couple of other features.

All you do is install and activate the plugin and it is good to go. However, there is also a space provided to add additional URLs that you don’t want self pings coming from.

All in all, the plugin is lightweight, fast and easy to get running, and performs the exact function you need it to without any hassle whatsoever.

Let’s take a look at how to get the plugin installed and running.

Install and Activate Plugin

In order to stop a self ping in WordPress from happening, you first need to install and activate the plugin. You can do this by heading over to the plugins page in your WordPress admin dashboard. Simply search for the plugin name and install it from there.

Install and activate no self ping in wordpress plugin

Once the plugin has been installed and activated, you are ready to roll. It starts working automatically. However, you can also get to a setting to add other URLs that you want no self pings coming from.

To access this, click on Settings > Discussion. You will see this in the left side menu area of your dashboard.

Click on settings then discussion

Add Other URLs

At this point, you should be on the discussion page of your dashboard. You will see a lot of different options that you have configured in the past.

Scroll all the way down to the bottom of this page. Here, you will see a “No Self Pings” area that includes a box for you to add additional URLs if you choose.

Additional URL box

Go ahead and add any you want. If you do add some, make sure to click on the “Save” button to apply those changes and get those URLs added.

Manually Insert Code to Stop Self Pings

You can manually insert some code snippets in the functions.php file of your website. Below, you will find code for both self pingbacks and trackbacks. The process is not difficult. However, if you are not comfortable with code, then give your website developer a call.

In order to add code to stop a self ping in WordPress or to stop a trackback, you first need to access the functions.php file on your website.

Click on Appearance > Theme Editor, located in the left menu of your WordPress admin area.

Click on appearance then theme editor

This takes you to the files of your website. Click on the tab titled Theme Functions (functions.php). This gives you access to the proper file.

Click on the theme funstions functions.php tab

Once in the file you are going to scroll down to the bottom and add the following relevant code.

For Self Pingbacks

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’ );
add_action( ‘pre_ping’, ‘no_self_ping’ );

 

For Trackbacks

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

 

Once either or both of those codes have been added and you save your file, no self ping in WordPress should happen. Using code and adding it to your functions.php file is a great way to stop self pings. However, please remember the added code when you update the theme files as noted below.

Note: Remember, the only issue with adding code into a functions.php file is that when you update or change themes, you will need to add the code again. This isn’t true for every theme update, but double-check your file either way after updates.

This is why it’s good practice to use a child theme. The child will not overwrite any code changes should the parent theme update.

Final Thoughts

Having to deal with a self ping in WordPress is one thing. Having to do it all the time, well that is quite another. As stated above in this article, there are numerous issues with pingbacks and trackbacks.

In theory, they are supposed to be a good thing. But it turns out that more often than not, they just get in the way and can be confusing.

Using the methods above, you can quickly and easily stop self pings in WordPress. Whether you choose to use the plugin and that functionality, or put the code in manually, the choice is up to you.

While WordPress offers a ton of functionality and one of the best CMS platforms available, sometimes you will still run into an issue like this that needs a simple fix. Use either of the two methods above and you will eliminate self pings from WordPress in no time at all.

Have you ever tried stopping self pings before? What method do you prefer, the plugin or the manual code entry?

Author: Jeremy Holcombe

Growing up in Hawaii, Jeremy started his freelance writing career doing resumes, business plans, article writing, and everything in between. He now specializes in online marketing and content writing and is part of the Content Marketing Team at GreenGeeks.

Was this article helpful?

Related Articles

Leave a Comment

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