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 :
This is my first post
just saying HI
[...] Broken Link Checker Checks your posts for non-working links and lets you know (on the dashboard) if any are found. It’s of the “set and forget” kind, as it does the checks in background. Sometimes generates “false alerts”, probably because no site is up 100% of the time. And yes, this is one of my creations [...]
thx!! i’m going to try it
[...] Broken Link Checker Wordpress plugin has been updated to version 0.2! Here’s what’s new [...]
[...] you could also launch the script from the client side by using AJAX. This is what I do in my link checker plugin for WordPress. Another possibility is to store the tasks that need to be done in a database [...]
WordPress database error: [Unknown column 'hidden' in 'where clause']
SELECT count(*) FROM wp_blc_linkdata WHERE broken=1 AND hidden=0
No broken links found
WordPress database error: [Unknown column 'a.hidden' in 'where clause']
SELECT b.post_title, a.* FROM wp_blc_linkdata a, wp_posts b WHERE a.post_id=b.id AND a.broken=1 AND a.hidden=0 ORDER BY a.last_check DESC
tony : Try deactivating the plugin and activating it again.
[...] you could also launch the script from the client side by using AJAX. This is what I do in my link checker plugin for WordPress. Another possibility is to store the tasks that need to be done in a database [...]
[...] Broken Link Checker Wordpress plugin has been updated to version 0.2! Here’s what’s new [...]
I’m not sure if my previous message made it through, but I cannot get your latest, 0.2.2, version to work on my WP 2.3 installation. I can configure the settings, and the database does get your two tables, but it never actually checks the links. I’ve activated and deactivated and I have the same problem.
Peace,
Gene
I responded to your first comment here.
[...] In Wordpress? Our secret weapon to maintain our outgoing links in wordpress will be using this Broken Links Wordpress Plugin. This plugin allow you to set an option to check all your links within X hours and report back to [...]
Thanks for creating this plug-in – after installing WordPress I simply couldn’t understand why such a basic maintenance function is not included in the base package. Fortunately I stumbled upon your plug-in.
I upgraded to version 0.2.3 this morning but unfortunately it behaves just as erratically as the previous release – showing numerous (103 right now) and always changing ‘broken links’ that work just fine.
I cannot find any sensible explanation except that the plug-in might use time-outs to determine if a link is not there and that my site doesn’t respond fast enough. Could this be the case?
Yes, it does use timeouts – it has to set some limits so that the server isn’t overwhelmed by dozens of processes waiting for a page that might or might not load.
Currently the timeouts can only be changed by editing the plugin files. If you want to do this, look in the file wsblc_ajax.php, lines 229 – 230 (they contain the word “timeout”). The first number is the connection timeout (default = 15 seconds), the second is an “overall” timeout (default = 25 seconds). You can try setting higher timeouts.
If you give me a few examples of links that are reported as broken and yet work fine, I’ll try to find out what the problem is.
BTW, the list of broken links is always changing because existing links are re-checked every once in a while, plus links that are reported as broken are being rechecked several times to (hopefully) get rid of most false positives.
Eh, bugs :/
http://www.prepressure.com/postscript/troubleshooting/errors
There are loads of ‘missing links’ on this page but I am fairly certain the page is OK
I doubled those two time-out values but this does not solve the problem.
I am also troubled by ‘Error 500′ issues when using the ‘Broken links’ plug-in. This forces me to log-out of my Wordpress session – pretty annoying!
Forgot to mention that there is indeed a constant in the incorrect reporting of broken links: it typically happens on pages with 20+ links in them. Problem is that I have a few dozen of those on my site – with the above page holding over 100 links.
Of course I wouldn’t need your plug-in if I didn’t have loads of links on my site
Okay, I took some links from the page you mention and fed them into my local copy of the plugin… some of them turned out saying “broken”. I decreased the number of links in a single post to around 30 and they all checked out as not broken then… not good.
Some kind of timeout still seems likely. In addition to the network timeouts there’s also the script execution timeout, often enforced on shared servers – this causes any scripts that run for longer than X seconds be terminated. If the plugin is running over this limit it might behave inconsistently. I’ll look into it (might take some time). Meanwhile, set the timeouts you changed back to the defaults and see if changing the “session length” in the options tab to something in the range of 10 – 15 seconds is any help.
What about “Error 500″? How/when do you get those? I’ve never seen the plugin cause them myself.
The ‘Error 500′ messages appear at random but frankly scare the hell out of me.
Looking at temporary alternative solutions to check links I tried an online service (http://www.dead-links.com) a few minutes ago but that also reports error 500 issues!
I have deactivated your plug-in. As a fairly unexperienced Wordpress user, I have no idea what exactly is going on and don’t want to run into a situation that I cannot possibly fix myself without reinstalling. I guess it is better for me to stay away from beta plug-ins but once it gets a bit more reliable I’ll be back.
Eh, I usually try to fix any reported bugs, but diagnosing a random error on somebody elses site is, as you can probably imagine, very hard. So no guarantees.
I suspect third-party/hobbyist plugins in general tend to remain in “eternal beta”
Thanks – it works perfectly!
Suggestion:
Add a field/column: Status (published/ draft/ private/ pending moderation/ …)
Perhaps also allow filtering by status.
I have 211 broken links, but 175 are from 7 draft emails.
(They were published, but I had already found they were a mess, so the proper status is un-published – I wish we could designate them as such, not as drafts, but sorry, that’s not about your plugin.)
It would be easier to deal with the broken links if I could only address the published ones.
OR
Add an ignore list, so I can check a box, or copy and paste something, or if need be enter the post id#, so that those broken links won’t display, but a note will, reminding: “the following posts/pages are on your ignore list – they may contain broken links not listed above”.
Thanks again.
Thanks, and I’ve noted your suggestion. Though with the Christmas/etc coming closer I’m getting lazy, so don’t expect it to be implemented anytime soon
Here are a few false positives – the checker says these are broken, but they aren’t.
http://www.amazon.com/Elements-Organic-Gardening-Prince-Charles/dp/0297844164/ref=sr_1_1/002-6538492-7010462?ie=UTF8&s=books&qid=1190925978&sr=8-1
http://astore.amazon.com/gristmagazine/detail/1576753611/102-1183543-3665742
http://www.imdb.com/title/tt0090798/
http://www.louvre.fr/anglais/collec/peint/inv0054/peint_f.htm
http://www.algds.com/
http://pressroom.pbs.org/photos/brain_fitness_merzenich?programid=the_brain_fitness_program_with_dr_michael_merzenich
(205 links correctly identified as broken, 6 falsely identified.)
On the wp-admin/options …, I selected Link Checker, then clicked “Recheck”. It returned “No broken links found”. Surely it should say “No new broken links found”.
Then I checked Manage – Broken Links, and this time it only showed 3 broken links. I re-loaded the page, and it showed 6, then 11, then 60 then 139, then 181, then 189.
All the above false positives appeared again.
And there’s one new false positive:
http://www.imagiscape.ca/wiki/tiki-index.php?page=Breakfast+of+Champions
I checked some of these false positives and concluded they occur due to a bug. It was a relatively simple one and I think I have fixed it now. You can download the new version from this post (above). Or you could wait for the update notification which will appear in a few hours.
[...] Plugin nennt sich Broken-Link-Check Bookmarken [...]