Broken Link Checker for WordPress
Sometimes, links get broken. A page is deleted, a subdirectory forgotten, a site moved to a different domain. Most likely many of your blog posts contain links. It is almost inevitable that over time some of them will lead to a “404 Not Found” error page. Obviously you don’t want your readers to be annoyed by clicking a link that leads nowhere. You can check the links yourself but that might be quite a task if you have a lot of posts. You could use your webserver’s stats but that only works for local links.
So I’ve made a plugin for WordPress that will check your posts (and pages), looking for broken links, and let you know if any are found.
Download it now! (40 KB)
Note : This page, and the feature list below are slightly out of date as a major update has been released recently (see details). I’ll get around to updating this page eventually.
Features
- Checks your posts (and pages) in the background (whenever the WP admin panel is open ).
- Detects links that don’t work and missing images. Checks both internal and outbound links.
- Notifies you on the Dashboard if any problems are found.
- Link checking intervals can be configured.
- New/modified posts are checked ASAP.
The broken links show up in the Manage -> Broken Links tab. If any invalid URLs are found a notification will also show up in the sidebar on the Dashboard.
The Broken Links tab displays a list of invalid URLs found along with the relevant posts and the anchor text of the links. “View” and “Edit Post” do exactly what they say and “Discard” will remove the message about a broken link, but not the link itself (so it will show up again later unless you fix it; this plugin doesn’t modify your links).
By default all old posts/links are re-checked every 72 hours, or you can set a different time period.
Notes (Semi-Technical)
I realize there’s a lot of features that could be added to improve this plugin considerably. However, this release is intended to “test the waters” and see if there’s demand for a plugin like this, so I only implemented the most basic functions. The plugin has been upgraded to be slightly beyond “basic”
I thought about using WP’s pseudo-cron to run the link checker by schedule and decided against it. AFAIK the cronjobs execute when a page is requested; since this plugin does some lengthy processing it may increase page load times unacceptably when used in this manner. That’s why I set it to run the checks asynchronously (AJAX) and invisibly in the admin panel.
Installation
Just like any other WordPress plugin -
- Download (see below).
- Unzip.
- Upload the broken-link-checker folder to you wp-content/plugins directory.
- Activate the plugin in the Plugins tab.
Upgrading
- Deactivate the plugin (important!).
- Do steps 1.-3. from “Installation”.
- Upload the broken-link-checker folder to you wp-content/plugins directory.
- Re-activate the plugin in the Plugins tab.
Download
Version 0.5.3 : broken-link-checker.zip (40 Kb)
Requirements
- WordPress 2.7 or later
- MySQL 4.1 or later
Starting with version 0.5 this plugin is only compatible with WordPress 2.7 and up. Older versions (e.g. ver. 0.4.14) should work with WP 2.1 – 2.6.x.
Related posts :
Works fine with WP 2.6!
On one of my projects, images and links are added in custom fields. Coould you please consider as an option a check in custom fields? Thanks
@Razvan Antonescu – I’ll add that to my idea list. Though I can’t promise you’ll see it implemented anytime soon.
Oh well, I can understand that that is not a very common use and priority must be given to regular users. So if it’s on your list is more then enough for me
I had huge problems with this plugin eating up lots of resources on the server, leading to 500-er “internal server” errors after I upgraded to WP 2.6. Therefore I had to disabled the plugin for now. this is using the latest plugin version.
Excellent plugin.
Two suggestions:
- exclude ‘revisions’ and ‘autosave’.
- include an option for ‘orphaned pages’ (I have so many pages and can’t really tell which ones are actually being linked to…)
@Karel – okay, it makes sense to exclude revisions & autosave. I’ll add this right now.
Also, Eric, this might be the cause for the unexpected server load you experienced (maybe
), so the next version might work better.
Nope, same problem (error 500) also with version 0.4.3.
I’m running WordPress 2.6 and just installed Broken Link Checker 0.4.3. I thought this was working beautifully on two different sites but I just noticed a Fatal Error message at the bottom of the Write Post page on one of the sites (not the other one, which is a different ISP):
Fatal error: Call to undefined function: curl_init() in /wp-content/plugins/broken-link-checker/wsblc_ajax.php on line 294
Can you issue a modification that doesn’t use Curl?
@Cynthia – that would be a pretty complex task. Not likely in the foreseeable future.
Looks like I found a bug. The broken link checker 0.4.3 records a URL which returns a 401 as a broken link. These are NOT broken links. They’re sites that require a login. Example is http://www.totalfark.com/
@Michael Hampton – Hmm, good point. I’ll update the plugin.
[...] Broken Link Checker [...]
[...] was made possible by the Broken Links Checker plugin for WordPress, which made the process very easy and helped me to detect/repair links in all of the posts on the [...]
Oops, I think I found another one. If there are two or more links to the same URL in the same page, editing, discarding or unlinking affects all of them. This isn’t necessarily desirable. In my case I wanted to edit one and unlink the other, but both of them got unlinked and I had to put one back in.
And if you hit Discard, then while all of them get discarded, only one of them is removed from the listing via AJAX.
@Michael Hampton – I think it makes sense to change/remove all broken links, so I won’t change that. I’ll look into fixing the Discard/AJAX issue though.
[...] der englische Name des Plugins schon erahnen lässt, untersucht “Broken Link Checker” Ihren Wordpress-Blog automatisch nach so genannten toten bzw. verweisten Links. Sollte die [...]
[...] stolper ich über das WordPress-Plugin Broken Link Checker. Das ist gut, denk ich. Der Checker entfernt die toten Links nicht gleich, der checkt die [...]
[...] der englische Name des Plugins schon erahnen lässt, untersucht “Broken Link Checker” Ihren Wordpress-Blog automatisch nach so genannten toten bzw. verweisten Links. Sollte die [...]
i have the problem that my wordpress blog is now running on new webspace and of course your plugin found morgen than 500 broken links.
so it would be great to change all broken links at the same time.
http://www.xyz.de/wordpress to http://www.123.de/wordpress
so maybe you can include this possibility to your plugin!
would be great!
change all xyz to 123 !
@Rob Vegas – That’s a good idea, but I think there are already plugins that can do this. I’m pretty certain I’ve seen some “global search & replace” plugins before, Google may turn some up.
Hey, I’ve got some oddball stuff going on here with version 0.3.5. Specifically it seems to run for a while, and then gets stuck at, for instance, “3 posts and 9278 links in the work queue.” It’s been sitting here for four days, despite having the setting to recheck everything every 72 hours. Any idea how I can figure out what’s going on?
Er, excuse me, I seem to have version 0.4.4. not 0.3.5.
@Michael Hampton – I’ve thought about your problem for a while and haven’t thought up anything useful. I don’t know why it’s stalling. I’ll let you know if I get any ideas.
I think this is an excellent plugin, thanks so much for your work on it.
Our blog has many levels of users. We’d like to allow editors to use the Broken Link Checker, but they have “insufficient permissions.” Is there a way to extend permissions beyond just administrators? Thank you.
@Kate – It’s not easily extendable – you’d need to edit the source code. If you’re up for that, what you need to do is replace two references to ‘manage_options’ (around line 340) with ‘edit_others_posts’. This should give editor-level users access to the plugin.
Hello! I think that this plugin is really useful… However, I noticed that with wordpress 2.6 can give some problems. Watch this post in my blog:aggiornamento-a-wordpress-26
I think this can help to solve the problem.
Thank you and see you soon,
Denis
@Denis – Riiight. I can’t really read that (as I don’t know the language), but if you mean the “Internal Server Error” thing it’s probably caused by some tricky server configuration conflict. For example, it could be some security-related Apache module that causes this, or a .htaccess thing.
@White Shadow – @White Shadow – Sure, it’s italian
However if I deactive the plugin, all things works right again… See you
[...] for almost 6 years and have not made many changes to it recently. I had, however, installed the Broken Link Checker plugin and thought that was the culprit. Anyway, I told my host that I would remove the problematic [...]