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)
November 11th, 2007 at 11:42 pm
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
November 11th, 2007 at 11:20 pm
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 :/
November 11th, 2007 at 11:03 pm
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?
November 5th, 2007 at 4:16 pm
[...] 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 [...]
October 26th, 2007 at 1:51 am
I responded to your first comment here.
October 26th, 2007 at 1:34 am
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
October 22nd, 2007 at 6:44 am
[...] Broken Link Checker Wordpress plugin has been updated to version 0.2! Here’s what’s new [...]
October 22nd, 2007 at 6:38 am
[...] 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 [...]
October 17th, 2007 at 12:29 am
tony : Try deactivating the plugin and activating it again.
October 16th, 2007 at 11:56 pm
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
October 16th, 2007 at 7:23 pm
[...] 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 [...]
October 13th, 2007 at 11:22 pm
[...] Broken Link Checker Wordpress plugin has been updated to version 0.2! Here’s what’s new [...]
October 11th, 2007 at 10:11 am
thx!! i’m going to try it
October 4th, 2007 at 8:13 pm
[...] 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 [...]
September 9th, 2007 at 1:33 am
This is my first post
just saying HI