Broken Link Checker for WordPress

Notice: This plugin has been transferred to ManageWP. I am no longer working on it. Please direct any feedback to the new developer. See the plugin homepage for more information.

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.

Features

  • Detects links that don’t work, missing images, deleted YouTube videos and other problems.
  • Periodically checks links in posts, pages, comments, custom fields and the blogroll.
  • New and modified entries are checked ASAP.
  • Notifies you on the Dashboard if any problems are found.
  • Lets you edit all instances of a specific link at once.
  • Gives you a list of all links ever posted on your site, with the ability to search and filter it.
  • Lets you apply custom CSS styles to broken and removed links.
  • Highly configurable.

The broken links show up in the Tools -> Broken Links tab along. If any invalid URLs are found a notification will also show up on the Dashboard widget. To save screen real-estate, the widget can be configured to stay closed most of the time and automatically expand when broken links are detected.

Download

broken-link-checker.zip (412 KB)

    Requirements

    • WordPress 3.0 or later
    • MySQL 4.1 or later

    The current version of this plugin is only compatible with WordPress 3.0 and up. If you have an older version of WP, try one of the older releases. Specifically, version 0.8.1 is the last one that’s still compatible with the WP 2.8 branch, and version 0.4.14 is the last one compatible with WP 2.1 – 2.6.x.

    Installation

    Install “Broken Link Checker” just like any other WordPress plugin :

    1. Download the .zip file (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.
    Related posts :

    2,584 Responses to “Broken Link Checker for WordPress”

    1. White Shadow says:

      @Nokao – I see why the plugin wouldn’t work in that configuration, but I’m not quite sure what you mean by “in a relative way”. It’s already using a relative path to include wp-config.php, do you mean I should use an absolute path, or what?

    2. Nokao says:

      Originally Posted By White Shadow@Nokao – I see why the plugin wouldn’t work in that configuration, but I’m not quite sure what you mean by “in a relative way”. It’s already using a relative path to include wp-config.php, do you mean I should use an absolute path, or what?

      Hi White Shadow (and compliments for your storms pictures, we have the same photographic taste for natural strength).

      I said “relative” because someway, your plugin recognizes that he is in a “symbolic link jailed folder”.
      The point is that it’s the only plugin that it’s not working and I think that it’s not the only that uses the wp-config someway.

      I’m not a WordPress hacker, so maybe you can look how do plugins like nextgen gallery look into the wp-config file…

      I also have another question I posted months ago:
      to remove the check of links that have different protocols from http, like for example skype://
      Your plugin hates my msn and skype “addme” buttons 🙂

      Thanks again for your work!

    3. White Shadow says:

      @Nokao – It doesn’t “recognize” it, it just tries to include the file as if the plugin was in the usual location, and, obviously, fails. I don’t think there’s anything I can do to the plugin to fix this except overhauling the entire AJAX part of it and getting rid of wsblc_ajax.php altogether. That would take a lot of time & work, so it probably won’t happen in the foreseeable future.

      For the time being, you should just edit the plugin and replace “../../../wp-config.php” with a full path to the wp-config.php file. Hopefully I’ll be able to remove this need for hacks in the next version – but, as I said, it probably won’t be soon.

      Ah, and thanks for the compliments 🙂

    4. Nokao says:

      @White Shadow

      🙂

      Ok… I’ll surrender to the fact that I can’t use your plugin in that server 🙁
      (i’ll continue to use that for my personal blog)

      Infact, I can’t change the ../../../ folder with something, because, you know, I did that “hack” to have the SAME plugins folder with more than 25 wordpress websites.
      So I can’t know wich website is calling the function, and I can’t address a wp-config.php in an absolute way.

      I really hope that your plugin is the only that have that problem… I’m curious about that.
      Actually, all seems to be working fine.

    5. White Shadow says:

      @Nokao – Oops, I forgot about that. You’re right, my suggestion wouldn’t work.

      Other plugins work because either they don’t use AJAX at all or use it in a different way (possible, but as I mentioned it would take a while to convert this plugin to use the other method).

    6. Nokao says:

      @White Shadow

      Uh 🙁

      Even nextgen-gallery have SOME problems, in the admin menu’, the link is wrong and it’s a mix of server path and symlink.

      I don’t understand honestly why this is happening… and why you need to look for wp-config.php

    7. White Shadow says:

      @Nokao – Do you really want to know all the details?…

      Okay, for my plugin it’s like that : the link checks run in the background using AJAX in the admin menu. This is necessary because I can’t expect every user to set up a cronjob for the broken link script.

      In WordPress plugins an AJAX-y component can be built in several ways. This plugin uses a different PHP file for the AJAX tasks. The file, wsblc_ajax.php, needs to be able to access the WordPress database to be able to read posts and check links in them, etc. That’s why it needs to load the WP core engine and blog configuration. This is done by including wp-config.php. Also, the plugin needs to load the database layer, so it includes wpdb.php.

      That’s it 😛

    8. That seems to happen on CGI and FastCGI installations of PHP, which is the vast majority. Apparently the symlink is getting dereferenced when the file is loaded. So the script has no idea where it was called from, but instead sees where it actually is on the filesystem. Therefore it can’t figure out where anything else is because it isn’t in the directory tree you expected. My test Apache/mod_php install doesn’t seem to have this problem, though my FastCGI install does. As far as I know there’s no good way to “fix” this.

    9. Nokao says:

      @Michael Hampton

      Maybe we can try with an hard-link ?

      Can you contact me in private so we don’t go off-topic here on White Shadow’s website?

      info at
      nokao dot
      com

    10. Nokao says:

      If someone reads my previous questions about having a multi-blog engine installed to have only one WP and of course only one plugins/themes folder… and wants to know if there is a solution…

      Yes, there is, and it’s called:
      http://striderweb.com/nerdaphernalia/features/virtual-multiblog/

      I’m astonished… now I have more than 20 WP websites with a single WP installation, no more multi-update-caring and balls-breaking.

      Bye

    11. Web Master Blog says:

      Thanks a lot for the great add-on, should save me having to use a manual solution.

    12. Dan says:

      I just installed the plug in and works really great but since then the wp admin becomes really slow, do you know or anybody knows or have the same issue?
      thx!

    13. White Shadow says:

      @Dan – Some users have had similar issues, but the only thing I can suggest is trying a different browser. I think the problem is site/browser specific.

    14. I think the broken link checker hmight have a problem with del.icio.us (wonder if their nofollow is part of it?) BLC is showing false positives for just about ALL my del.icio.us tag links. For about a month earlier this year I was doing a LOT of bookmarking on delicious and was having del.icio.us do a daily post to my blog since the bookmarks were of mostly useful, relevant content – in a nutshell, I have LOT of del.icio.us bookmark links on my site and BLC is showing 3000+ bad links I have nary the time to go thru by hand so I ‘d be tickled pink if there arose a automagical remedy to this problem. – thx

    15. White Shadow says:

      @R. Richard Hobbs – Del.icio.us links seem to work fine on my test blog, so I’m guessing the problem is site-specific. I can only suggest you add del.icio.us and delicious.com to the exclusion list in Settings -> Link Checker.

    16. >>> I can only suggest you add del.icio.us and delicious.com to the exclusion list in Settings -> Link Checker.

      <<< thanks for that – I really only turned BLC back on yesterday after I had deactivated a while back. I have been keeping it updated but I hadnt really noticed that feature – thx again

    17. Feature request: make links to check open in new tab or window
      Feature request: make your comment form remember me

      thx

    18. White Shadow says:

      @R. Richard Hobbs – Could you clarify what you mean by “links to check”?

      As for the comment form, I’m aware of the problem – it’s caused by the same plugin that handles comment paging. I’ve let the author know about this bug, but it’s not fixed yet. And I think disabling the plugin would be a bad idea – for example, this page would take forever to load with >250 comments on one page.

    19. >>> Could you clarify what you mean by “links to check”?

      <<< after the BLC has done its work you are presented with a list of bad links it has found (it’s”edit” link is next to each of these) I’ll call this the “work page”… Normally I will confirm for myself they are bad if just click on each link you are moved off the work page and have to go back after following the link unless it is opened in a new tab or window. Its a relatively small chore but little things matter if there are a lot of links to check. Automatically opening the link in a new tab (or giving users the option on the config page would please me immensely.

      Another suggestion might be to be able to select all the text automatically (like the “embed” box on Youtube) in the edit form window. There appear to be lots of free javascripts that do this. Admittedly I havent gotten in there and tried it so I cant say exactly how easy or hard it might be to implement this, but for me it would be a helpful feature.

      Thanks again for your hard work and kind ear.

    20. White Shadow says:

      @R. Richard Hobbs – Ah, I usually just middle-click those links which opens the link in a background tab in Opera. Anyway, I’ll make them open in a new window by default (the window/tab distinction is browser-specific, can’t control it from JS AFAIK).

      I’ll see what I can do about auto-selecting the text.

    Leave a Reply