By default, WordPress blog automatically send a pingback to itself any time you link to one of your own internal old post. It would be nice if this self-pingback feature can be turned off in the dashboard.
Self-pings, or pings within your own blog, are found useful by some, annoying by others. Those who find them useful feel that self-pingbacks is a good approach to increase inter-linking between posts.
You can stop self-pings if you wish. You can simply manually delete them once you get them in the WordPress dashboard, or you can use one of the 2 methods below to automatically disable self-pings to your own blog.
What are Pingbacks?
Pingbacks are automated cross referencing system between blogs. Pingbacks are designed that you receive a notification when another blog links to one of your posts. For more details, read my previous tutorial: Trackbacks and Pingbacks in WordPress.
What About a Plugin?
There are plugins that disable self pingbacks but you really don´t need a plugin for such a simple task. Also I encourage you to read my previous post about unnecessarily adding plugins to your theme. Personally, I am not a fan of plugins, I prefer to use a snippet of code instead.
How Self Pingbacks are Created
The best way to learn about self pingbacks is to create an internal link from one post to another on your blog. You will then find a pingback in your comment section.
Below is a screenshot showing 2 pingbacks after I inserted two internal links in a new post of mine to two other older posts on this blog.
If the 2 pingbacks above are approved, they will show up as comments in the 2 older posts respectively. For this time, I approved them both and you can check them out at old post1 comment and old post2 comment.
If Comments are closed for an older post, and you linked to it from a newer post on the same blog, then self-pingbacks will not be sent by WordPress. This is the only case, that WordPress will not send self-pingbacks if you decide not to take action by choosing either of the methods below.
2 Methods to Disable Self Pingbacks
If you don´t want to get self-pingbacks on your blog, you have 2 choices to stop self pingbacks from showing up as comments on your posts. Either method is just fine.
METHOD1 | No Self-Pingbacks | functions.php
One way to disable self-pings is to add CODE-1 to your theme´s functions.php file. Open the functions.php file located in your theme´s folder, and add (copy and paste) the following CODE-1. Save the file and upload it to the server.
CODE-1 :: Method1 to disable Self Pingbacks
Note: To scroll within the code: You can also click on the code window and use your keyboard´s arrow keys.
Self pingbacks are now disabled. Source WordPress forum.
Some themes, or theme frameworks, have more variations of the functions.php file, so look at their documentation and see where best to add the code.
CODE-1 is tested to work on WordPress version 3.3.1
METHOD2 | No Self-Pingbacks | Use Relative Path for Links
Another option to avoid self pinging, is to use relative path for the links in your post instead of absolute path. In other words, Replace the absolute links of your internal posts with relative links.
Of course, relative Links in your case are most likely different than in my case. It all depends on the structure of your blog's directory.
When you add several PHP code blocks in your theme´s funtions.php file, make sure that you do NOT leave any white space (spaces, newline) before the opening PHP tag (<?php) or after the closing PHP tag (?>). The correct way is as follows:
In the above code, if you leave any white space or a newline between lines 4 and 5, you will get the following error: “Warning: Cannot modify header information - headers already sent by…”
Your Turn to Talk
You now have the choice to disable self-pingabcks, without a plugin, and keep WordPress blog from pinging itself.
Some bloggers like to use the self-pinging feature as they find it beneficial for better inter-linking between posts, which I understand their point. The majority of the time I tend to delete self-pingbacks.
How easy did you find this tutorial to implement? I am interested to know your thoughts on the self-pingback feature. Do you have something to add? If so, please share your opinion in the comments section. Your opinion matters, unless it is a Spam.