Approximate time to read: 2 minutes
A WordPress plugin, named No Self Pings, has been around since, seemingly, the dawn of time (2006). Indeed, Matt himself added it to the SVN repository.
Since it’s release it’s only had one update (in 2007) and, more recently, has been plagued with users reporting that it didn’t work anymore.
And then, yesterday, this happened…
Yeah, I may have had something to do with that.
No Self Pings is a relatively straightforward, but useful, plugin that ensures that if you mention one of your own posts in a new post, you don’t get a “pingback” (which adds a comment to the original post). These pingbacks are quite useful but less so when it’s yourself generating it.
I use No Self Pings myself and it’s worked flawlessly. But I noticed a lot of users were beginning to state that it didn’t work. Looking at the code, it’s really quite simple – it uses a filter to intercept the array of URLs included in a post and then removes any related to the site. The filter hadn’t changed so why, recently, has it stopped working? The filter may not have changed but you know what has? SSL. People are now starting to use it a lot more.
The plugin knows the site’s URL by using the function
get_option( 'home' ). The thing is, this is set manually within a site’s general settings and represents “the blog’s home web address” (and shouldn’t be confused with the Site URL, which is defined separately). I believe that those users with issues had this set wrong.
home_url() is regarded as a better alternative which, amongst other things, ensures the SSL is set correctly.
It just so happens that the author of No Self Pings is an Automattician as well, so getting hold of him was easy. I proposed the change and said I would be happy to do it. I also created a matching Github repository, in which I added the past iterations of the plugin as well. He granted me access to the repository and I submitted the revised code, with myself now listed as a co-author. Matching my other plugins I also added some additional code which adds some useful plugin meta.
And I have plans too, including a settings field that will allow you to specify additional URLs that shouldn’t generate pings (could be useful if you have other sites, particularly if you’re using a multisite installation of WordPress).
If you have any ideas for further improvements, please let me know. Meantime, enjoy the update and, fingers crossed, it should now start working for all users!