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)
August 16th, 2008 at 6:26 pm
[...] ) 15-Auto Social Poster 16-Broken Link Checker 17-Global Translator [...]
August 15th, 2008 at 9:59 pm
Nah, it makes perfect sense
Actually I need a regexp for HTML links. I think I’ll need to update the existing one to use a backreference to ensure it only accepts matching types of quotes for the opening and closing quote of the href parameter (I think that sentence got a bit tangled).
Anyway, I’m putting that off, because currently I have a more pressing issue - finding out how somebody managed to hack this site today. I’ve got it back working, but now I need to read the logs and whatnot…
August 15th, 2008 at 9:49 pm
The official regex for URIs is
^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?Confused yet?
August 15th, 2008 at 9:20 pm
@hillman - There is no log.
The plugin can probably get confused by links that contain a quote. I’ll need a more advanced link-finding regexp to solve that, but it’s doable.
August 14th, 2008 at 4:59 pm
Xenu Link Sleuth produces some sort of error message on Wikipedia links (”forbidden”), I am guessing the same thing that stops XLS also blocks the BLC4WP.
August 14th, 2008 at 4:22 pm
@White Shadow - I see. Perhaps I’ll just discard those errors. Thanks for the reply!
Does Broken Link Checker keep a log of the checking result? Like, whether it reports the link as broken coz it gets a 404 or 503 when checking?
Also, one of the link in my blog is linking to:
http://en.wikipedia.org/wiki/Pandora’s_box
but BLC is reporting the link as:
http://en.wikipedia.org/wiki/Pandora
Does it stumble on single quote in the URL?
August 14th, 2008 at 12:29 pm
@hillman - Wikipedia links work okay (i.e. not detected as “broken”) on my blogs, but some other users seem to have problems with them. Maybe it’s really a problem with your server, or maybe Wiki is blocking certain ranges of IP addresses.
August 13th, 2008 at 3:35 pm
This is a great plugin! Except that it’s reporting links to nearly all Wikipedia pages as broken, while they not. Such as:
http://en.wikipedia.org/wiki/Pandora
http://ja.wikipedia.org/wiki/%E7%A5%9E%E3%81%AE%E9%9B%AB
Is there something funny about these Wikipedia pages? Or is it just that the Wikipedia web sites can’t be reached from my host?
August 13th, 2008 at 12:29 am
[...] Le nettoyage consiste à vérifier et corriger les liens morts. Pour cela, j’ai installé le plugin Broken link checker [...]
August 12th, 2008 at 9:36 pm
@Bleh - Depends on your browser… I’ve had no problems with it
August 12th, 2008 at 9:24 pm
BLOATWARE ALERT… caused my blog to take FOREVER to load… probably because I have LOTS of content… but still! This is hardly “running invisibly in the background”!!!
August 12th, 2008 at 11:46 am
[...] the Wordpress Broken Link Plug In, I found that along with the hundreds of links to my old web site I had over 160 broken links on my [...]
August 12th, 2008 at 6:32 am
[...] Broken Link Checker scans all your articles and their internal links to verify that none of them are broken. I haven’t kept this plugin continuously active, though did check my entire site after upgrading and changing many of my categories, and, happily, there were no broken links. [...]
August 10th, 2008 at 8:38 pm
[...] Broken Link Checker - This plugin will monitor your blog and looks for any broken links and let you know if any broken links are found. [...]
August 9th, 2008 at 4:45 am
[...] 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 [...]
August 8th, 2008 at 4:50 pm
@White Shadow - @White Shadow - Sure, it’s italian
However if I deactive the plugin, all things works right again… See you
August 7th, 2008 at 11:21 pm
@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.
August 7th, 2008 at 10:59 pm
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
August 7th, 2008 at 7:54 pm
@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.
August 7th, 2008 at 7:36 pm
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.
August 7th, 2008 at 1:13 pm
@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.
August 7th, 2008 at 12:49 am
Er, excuse me, I seem to have version 0.4.4. not 0.3.5.
August 7th, 2008 at 12:48 am
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?
August 6th, 2008 at 12:17 pm
@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.
August 5th, 2008 at 1:58 am
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 !
August 3rd, 2008 at 4:44 am
[...] 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 [...]
August 3rd, 2008 at 1:00 am
[...] 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 [...]
August 2nd, 2008 at 10:13 pm
[...] 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 [...]
August 2nd, 2008 at 1:37 pm
@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.
August 2nd, 2008 at 7:09 am
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.