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 -

  1. Download (see below).
  2. Unzip.
  3. Upload the broken-link-checker folder to you wp-content/plugins directory.
  4. Activate the plugin in the Plugins tab.

Upgrading

  1. Deactivate the plugin (important!).
  2. Do steps 1.-3. from “Installation”.
  3. Upload the broken-link-checker folder to you wp-content/plugins directory.
  4. Re-activate the plugin in the Plugins tab.

DownloadCC-GNU GPL
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.

Share :
  • Reddit
  • del.icio.us
  • Digg
  • StumbleUpon
  • DZone
  • Ping.fm
  • Sphinn
Related posts :

895 Responses to “Broken Link Checker for WordPress”

Pages: « 13 4 5 6 7 [8] 9 10 11 12 1330 » Show All

  1. 206
    Kate says:

    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.

  2. 207
    White Shadow says:

    @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.

  3. 208
    Denis says:

    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

  4. 209
    White Shadow says:

    @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.

  5. 210
    Denis says:

    @White Shadow@White Shadow – Sure, it’s italian :-P However if I deactive the plugin, all things works right again… See you

  6. [...] 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 [...]

  7. [...] 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. [...]

  8. [...] 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. [...]

  9. [...] 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 [...]

  10. 215
    Bleh says:

    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”!!!

  11. 216
    White Shadow says:

    @Bleh – Depends on your browser… I’ve had no problems with it :P

  12. [...] Le nettoyage consiste à vérifier et corriger les liens morts. Pour cela, j’ai installé le plugin Broken link checker [...]

  13. 218
    hillman says:

    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?

  14. 219
    White Shadow says:

    @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.

  15. 220
    hillman says:

    @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?

  16. 221
    Branko Collin says:

    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.

  17. 222
    White Shadow says:

    @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.

  18. 223
    Michael Hampton says:

    The official regex for URIs is ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?

    Confused yet? :)

  19. 224
    White Shadow says:

    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…

  20. [...] Ýì æÞÊåÇ Úáì ÒæÇÑ áãÔÇåÏÊåÇ) 15-Auto Social Poster ãËáå ãËá ÇáÓÇÈÞ æáßä Ýì ÇÎÊáÇÝ ÈÚÖ ÇáãæÇÞÚ 16-Broken Link Checker íÈÍË Úä ÇáÑæÇÈØ ÇáãÊßÓÑÉ Ýì ÇáãÏæäÉ æíäÈåß áÇÕáÇÍåÇ 17-Global Translator åÇß [...]

  21. [...] plugin Broken Link Checker habe ich erst kürzlich eingebaut. es läuft im hintergrund und scannt alte postings nach [...]

  22. 227
    Michael Hampton says:

    OK, more on my broken link checker stopping in the queue. It appears to get hung up when checking a link to http://www.phl.org/ . The site never loads up, the curl call never seems to actually time out as it should, and so the AJAX call comes back with a 504 (Gateway Timeout) error. When I manually removed this link from the blc_linkdata table, it went happily on checking the rest of the queue.

  23. 228
    White Shadow says:

    @Michael Hampton – Hmm, I guess I’ll have to think of something to detect cases like that.

  24. 229
    Michael Hampton says:

    Well, curl should be timing out, but it isn’t. Looks like the CURLOPT_TIMEOUT isn’t being honored. I don’t know if that’s a bug in curl or in PHP, but it’s certainly a bug.

    Anyway, I worked around it by just having the link checker pull links from the work queue randomly, i.e.:

    /* check the queue and process any links unchecked */
    $sql="SELECT * FROM $linkdata_name WHERE ".
    " ((last_check<'$check_treshold') OR ".
    " (broken=1 AND check_count<5 AND last_check<'$recheck_treshold')) ".
    " ORDER BY RAND() LIMIT 100";

    Now it’s at least checking most of them. :)

  25. 230
    White Shadow says:

    @Michael Hampton – I seem to recall that “ORDER BY RAND()” is considered a bad thing performance-wise.

  26. 231
    Michael Hampton says:

    Sure, it’s a performance problem if you’re randomizing a few million records. Randomizing 100 is trivial.

    P.S. Please fix your comment form. I’m going nuts having to re-type my information in all over again every time.

  27. 232
    White Shadow says:

    @Michael Hampton – I’ll use a different workaround. The new version should be up soon.

    I think one of my antispam plugins is causing the comment problem. I’ll investigate, but it might take a while.

  28. 233
    Çim Çit says:

    really works thanks

  29. 234
    Dai says:

    Hello, nice to meet you, Janis.

    This is nice plugin.
    I fixed a lot of broken links on my blog.

    But, first time, I got a error below at “Status : ” area on admin page:

    Fatal error: Cannot redeclare class wpdb in /var/www/wp-includes/wp-db.php on line 53

    So, I remove the line

    require_once(”../../../wp-includes/wp-db.php”);

    from wsblc_ajax.php , thinking it was negative solution.

    Today, I found an article, “Tackle Plugin Compatibility Issues While Using Popular Libraries” : http://weblogtoolscollection.com/archives/2008/08/27/tackle-plugin-compatibility-issues-while-using-popular-libraries/

    Yes, That might be the answer!!

    I changed like below :

    /*
    The AJAX-y part of the link checker.
    */
    require_once(”../../../wp-config.php”);
    if(!class_exists(’wpdb’)) {
    require_once(”../../../wp-includes/wp-db.php”);
    }

    I GOT IT!!!

    It potentially has same problem in require_once(”../../../wp-config.php”), maybe.

    I wish my work will help you, thank you.

  30. 235
    White Shadow says:

    @Dai – While I haven’t encountered this problem before your suggested modification certainly can’t hurt. I’ll add it to the plugin :)

    However, I think using “isset($wpdb)” instead of “class_exists(’wpdb’)” will be a better choice because the comments in wp-db.php indicate that it is possible to replace this class by something else by setting the global variable $wpdb.

    Including wp-config.php should be okay, that just loads the WordPress core.

Pages: « 13 4 5 6 7 [8] 9 10 11 12 1330 » Show All

Leave a Reply