Skip to content

Link Verifier: A WordPress Plugin for Checking Links in Blog Entries

If you are a blogger, you likely understand the importance of ensuring that what you post to your blog is as good as it can be before you publish it. You try to determine whether or not there are better ways of expressing ideas that you wish to convey. You take out anything in it that is superfluous and would only serve the purpose of adding clutter to your entry. You check for spelling errors in what you have written, as it is well-known that spell-checking software cannot find all spelling errors. You want to ensure that what you will post to your blog is free of any errors that would make it appear unprofessional. And one kind of error you want to avoid is the inclusion of invalid links in your blog entry. You do not want to provide a link to a page with a 404 error when it is supposed to be a link to a page with information that you consider useful to your readers. You may click each link in your post to determine if each of these links are valid. However, with everything else you need to do, would you not like to have these links checked automatically?

I have had some interest in writing a plugin for WordPress, although I was not sure what kind of plugin to write. I had not experienced much difficulty in working with WordPress in my time using it. And any time there was some functionality I wanted WordPress to have, I found that a plugin for including that functionality was available. However, after a certain amount of manual link checking that I had done, I wanted a plugin for automatically checking links in blog entries before these entries that contain these links are posted. Reading the section on link verification web bots in Michael Schrenk’s book on web bots titled “Webbots, Spiders, and Screen Scrapers” may have also inspired me to write this plugin. And after not finding that a plugin for automatically verifying links existed, I found that I had every reason I needed to write this plugin.

I decided to use the cURL library for checking the HTTP codes that would be returned after clicking each link in the window for editing posts, as cURL is useful for retrieving this kind of information. For this reason, the cURL module needs to be installed for this plugin to work. I needed to retrieve only the HTTP codes in this plugin, as these codes are all that is needed to determine if links are considered “broken” or not. Any time a page is found to return an error code, the link is considered broken. And in this plugin, a filter is set up to modify what is in the editor window to include the error code in the link. Perhaps there might be better ways to alert the individual who is posting the link that the link is broken than to add text to the link. This is one issue that I will consider when writing future versions of this plugin, and there are other ideas that I have for future versions as well.

This plugin may be useful for finding links that are broken. However, it cannot determine which links are links to incorrect pages. Sometimes when entering a URL incorrectly, the user is taken to a page that is not the correct one, although not one that will give an error code such as 404. For that reason, I have considered including functionality for checking valid links for information such as their titles, and returning this information. In addition, the plugin works only with absolute links, and not relative links. I personally always use absolute links in my posts, although in the future I might include functionality for checking relative links. Whether or not this functionality will be included may depend on how much demand there will be for the inclusion of this functionality.

The plugin can be downloaded if you click here. Feedback on what I write is always welcome, and I would be interested in hearing opinions on this plugin. This is the first WordPress plugin that I have ever written, and I decided to get it released at this time to meet a deadline that I have set for myself. However, I have found that it worked correctly in tests that I have run with it, and I would like to know if there are any bugs that it has so that I can correct them. This plugin is one that may not be considered very useful now, although future versions of it may be more useful. I know that I would prefer to have one less concern when I write posts to this blog. And hopefully, I will not need to be concerned about this plugin not working properly.