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! (10 KB)
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.3.5 : broken-link-checker.zip (10 Kb)
(It needs at least WordPress 2.0.x to work, maybe 2.1.x. I’ve tested on 2.1.3 - 2.5)
March 8th, 2008 at 2:13 am
@White Shadow: You’re right, it seems to be working as expected. I am not sure why it reported false broken links before. I will keep monitoring the behavior .
_______________
Daniel
March 5th, 2008 at 2:36 pm
I’m not entirely sure why it showed up as broken in your blog. Nevertheless, I’ve made some tweaks to the plugin and it should now handle that URL correctly. At least it does on my test blog
March 5th, 2008 at 11:05 am
FYI: I changed my blog permalink structure and I use .htaccess file to redirect 301 all pages with the old permalink structure targetting to the new permalink structure, then I install BrokenLinkChecker.
BLC installed successfully BUT, this URL:
http://www.averagecoder.net/programming-tips/wordpress/how-to-easily-display-a-cute-google-map-inside-your-wordpress-post/
Which is working when you access it via web browser is identified as broken link by BLC.
I think it’s a good idea if BLC can works in conjunction with .htaccess rewrite rules.
_______________
Daniel
March 2nd, 2008 at 9:09 am
[...] Broken Link Checker: Checks your posts for broken links and missing images and notifies you on the dashboard if any are found. By Janis Elsts. [...]
March 2nd, 2008 at 12:03 am
[...] Broken Link Checker - Checks your posts (and pages), looking for broken links and lets you know if any are found. Email this to a friend [...]
March 1st, 2008 at 12:45 am
I TOTALLY LOVE this plugin… which is one of the most useful WordPress plugins I’ve come acrossed. I wish it would check broken links in comments… That would make it even more better.
February 26th, 2008 at 9:24 pm
I want complain on XHTML validation when enabling this plugin with broken link CSS turned on. It says that broken-link bla-bla is not valid.
Here is the solution (may be author would add this to further versions):
1. Open broken-link-checker.php.
2. Find there string:
echo ”,$this->options['broken_link_css'],”;
3. Replace it with:
echo ”,$this->options['broken_link_css'],”;
4. Save and upload changed file on server.
Thats all! Thank you for your attention. =)
February 22nd, 2008 at 4:48 pm
[...] So we had to go through all of our links to fix them one by one. (We are using a broken link checker plugin which identifies the posts where the broken links are hiding in, however, we still have to [...]
February 19th, 2008 at 12:53 am
[...] Wordpress Plugin Broken Links, welches ich vor ein paar Tagen aufgenommen habe, ist ein unverzichtbarer Link Checker. Dieses [...]
February 18th, 2008 at 6:52 pm
[...] Link Checker Plugin Version 0.3 I’ve gotten some interesting feature suggestions for my link checker WordPress plugin since I released the last version several months ago. During the last week I finally got around to [...]
February 16th, 2008 at 12:11 pm
[...] like to click on a broken link? There are a few ways to remedy this solution, but I found this broken link checker for WordPress that does the job extremely well and is completely free. You do not want your readers to be annoyed [...]
February 15th, 2008 at 9:07 pm
[...] Broken Link Checker 0.2.5 (Janis Elsts) :ce plugin vous permet de vérifier que vous ne proposez pas de lien mort sur votre blog. Un plugin de ce type est indispensable à quiconque est soucieux de proposer un contenu à jour. Un de ces services que l’on devrait absolument trouver en standard sur WP. [...]
February 12th, 2008 at 10:33 pm
[...] visitors to older posts have been running into the odd dead link, I searched for and easily found another great WordPress plugin that folds neatly into the blog’s administration and compiles a list of broken links, both [...]
February 7th, 2008 at 3:19 pm
Yes, it does. In fact, I just upgraded to 2.3.3 and it seems to be working okay.
February 5th, 2008 at 11:34 am
Does it works on WordPress 2.3.2?
thanks…
January 29th, 2008 at 2:32 pm
I don’t see why it wouldn’t work as it is (it does on this site), but I’ll change it anyway - it won’t harm anything
January 29th, 2008 at 5:32 am
Hi!
The link “View” at the broken-links don’t work to me.
I fix this with:
Please apply this patch to your next release.
$ cat broken-link-checker.php.patch
347c347
< post_id’ class=’edit’>View
—
> post_id).”‘ class=’edit’>View
January 28th, 2008 at 3:49 pm
Sunday Stroll…
Tamar Weinberg over at LifeHacker pulls out a post from Mother Tongue Annoyances that strives to help us all with that big Public Speaking Fear. Follow this advice and then come practice it at Toastmasters.
Found out about a great new WordPress Plugin …
January 26th, 2008 at 1:43 pm
[...] Broken Links Auf dieses Plugin möchte ich nicht mehr verzichten. Nichts ist schlimmer, als seine Leser mit nicht erreichbaren Links zu versorgen. Dieses Plugin prüft alle Links und meldet Fehlerhafte. Damit man nicht lange suchen muss, wird angezeigt, welcher Link in welchem Beitrag den Fehler hervorruft und kann mit einem Klick auf Edit, diesen händisch bereinigen. [...]
January 25th, 2008 at 1:42 am
[...] just found a fantastic WordPress plugin to check for broken links. I’ve installed it and it’s checking my blog as I type this. It’s found nine [...]
January 17th, 2008 at 12:56 am
[...] Plugin nennt sich Broken-Link-Check Bookmarken [...]
December 21st, 2007 at 2:13 am
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.
December 21st, 2007 at 1:48 am
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
December 21st, 2007 at 12:35 am
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
December 21st, 2007 at 12:00 am
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.
November 12th, 2007 at 1:27 am
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”
November 12th, 2007 at 1:05 am
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.
November 12th, 2007 at 12:53 am
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.
November 12th, 2007 at 12:32 am
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
November 12th, 2007 at 12:28 am
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!