If you have a large WordPress site with frequent links between articles, you know how irritating self ping backs can be. As a quick reminder, a pingback is generated whenever a WordPress blog links to another post that accepts them. If successful, it will create a link in the comments section of the “linked to” post either interspersed with normal comments, or collected at the end depending on the settings of the target. It frequently encourages conversation in the blogosphere when you link to someone else’s article and they hop over to comment on yours or even start a discussion on their own blog. In other words, it’s a great tool for building a community.
Self ping backs on the other hand can be annoying. If your blog is centered around a certain theme, you will find it useful to constantly link back and forth between your articles. This kind of interlinking structure keeps visitors engaged on your page and allows you to quickly reiterate the point without going into detail on the current post itself. As a result, it’s not unusual for a single post to have link backs to three or more previous articles – sometimes more. With the current system the way it is, all of these links to your own posts will generate pingbacks and possibly mess up your comment thread. This is especially true if you display them in reverse chronological order with paging. A new user is likely to see nothing but a long list of pingbacks instead of the comments that you want them to engage with.
Fortunately preventing these pingbacks is easy and only requires a little bit of work. You can approach this problem in two ways:
Use relative URLs;
Disable self pingbacks with the plug-in.
Use Relative URLs
When linking to a page on your own domain, you can use a relative URL instead of an absolute one. Most URLs are absolute – that is they start with a regular “http://” or “www” and contain the full path including the name of your blog. If you want to give your post URL to someone else, you copy and paste the absolute URL.
But there is another way to do this. Say your article URL is http://www.xyzmysite.com/2013/mypost.html. This is absolute. The relative counterpart is simply /2013/mypost.html. Go ahead and try it. Replace any absolute URL that points to your own post and delete the initial part that represents your blog.
One important thing to note is that relative URLs are not sent to your users. WordPress processes them internally and converts them into absolute URLs when viewed on a webpage. So the user doesn’t see any difference – it’s only internal. This has the side effect of disabling any self pingback that would have been generated by the internal link.
A side benefit of using relative URLs is that you can easily migrate your blog to another domain without any of your internal links breaking. This is an excellent long-term strategy to follow.
Using a Plug-In
Hardly surprising that some enterprising developers have created plug-ins to solve this very problem. One well-known add on is simply called No Self Ping and it neatly does what it claims to do – removes all self pingbacks.
Another option is to install a plug-in that converts all absolute URLs into relative ones going forward. Root Relative URLs does this though it requires you to dig into your wp-config.php file to make some modifications. It’s probably not everyone’s cup of tea.
My personal favorite is to go with relative URLs instead of absolute ones. While it’s true that traditional web design discourages relative URLs for a variety of reasons, the fact remains that WordPress developers frequently tend to move their site around to various domains and using relative URLs avoids further hassle. The additional benefit of course is that it disables annoying self pingbacks!
Is your website slow?
Enter its URL below to find out now:
- PREVIOUS ENTRY: How to Protect Your Custom CSS after Theme Upgrades
- NEXT ENTRY: Developing a Child Theme for WordPress