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. re 796 and your response 797
      I posted http://news.yahoo.com/news?tmpl=index&cid=716 which – when in the body of my post – redirects to http://news.yahoo.com/top-stories (but when in the address bar of my browser redirects to http://search.yahoo.com/404handler?src=news&fr=404_news&ref=&url=http%3A%2F%2Fnews.yahoo.com%2Fnews%2Fsections%2Fmaple%2Fen-US%2F )

      And nothing changes on the page of links. There are no redirects listed, and the number of broken links has not changed; looking at the last page of broken links I don’t see anything at all re: this post; and there’s nothing in the work queue.

    2. White Shadow says:

      Interestingly enough, that link is correctly detected as a redirect when I try posting it on my test blog.

      Check the last page of the All list, that’s where it will show up if it’s not detected as broken or redirected. Also, if/when you find it, click the “Details” button and check the log; it might be useful.

      Does your server have PHP safe_mode or open_basedir enabled? That’s known to cause problems with redirects.

    3. I tried again; this time I used http://www.portugalconsulting.com which redirects to http://www.portigal.com

      Details, from ALL

      1. Post published on : October 15, 2009
      2. Link last checked : October 15, 2009
      3. HTTP code : 200
      4. Response time : 0.109 seconds
      5. Final URL : http://www.portugalconsulting.com
      6. Redirect count : 0
      7. Instance count : 1
      1. Log : === First try : 200 ===

      HTTP/1.0 200 OK
      Connection: Close
      Pragma: no-cache
      cache-control: no-cache
      Refresh: 0.1
      Content-Type: text/html; charset=iso-8859-1

      Link is valid.

    4. I checked with my ISP and we have neither have safe_mode nor open_basedir enabled.

    5. White Shadow says:

      Alas, after a lot of testing and googling, I’ve discovered that this is probably a CURL bug. So it’s not something I can fix.

    6. Bummer; I wish I had done the redirects before we moved servers; it was great stuff that I wouldn’t otherwise find. I really appreciate your effort in tracking this down, but just so I understand a little bit more, is CURL an ingredient in your plugin? Is it something that is installed on my ISP? Is there something they can patch if I ask them? Etc. etc.

    7. White Shadow says:

      CURL is a command-line tool and a software library for transferring data over a variety of Internet protocols (e.g. HTTP). The library component (called libcurl) is installed on a lot of servers and can be used by PHP. I use it in my plugin because it’s generally a very robust and versatile way to query remote URLs.

      You could ask them to upgrade to libcurl 7.18.1 or later (the latest version is currently 7.19.6). That should fix the bug.

    8. Angel Romero says:

      Hey there, I’ve got this error once I installed the plugin.
      database_name.wp_blc_links’ doesn’t exist

      Any ideas? I tried activating and deactivating…no luck

    9. White Shadow says:

      No useful ideas so far, but the next version will be a bit more verbose when reporting errors like that (which should help us locate the bug) and do it upon activation so that you can see that there’s a problem right away.

    10. 6 plugins para el mantenimiento de tu Wordpress | triunfoweb.com says:

      […] Broken link checker: Se encarga de revisar los enlaces salientes de nuestro blog y comprobar que estos están activos aún o no. Muy útil para artículos antiguos. […]

    11. Texas Heat says:

      Every time I update Broken Like Checker, I have the same 15 broken links appear. All of them contain “2009/08/category/” in the URL. I remove this from the link and every thing is fine until the next upgrade. Is there something within the plugin that creates this problem? Or is it being created by some other plugin?

    12. Asmodiel says:

      Hi there!
      I have a problem with your plugin… every time I update it, I have to change one line (this update l. 2218) into $path = ini_get(‘upload_tmp_dir’);

      It is the opendir restriction, so do me a favor please and change it 😀

      Have a nice day,
      Asmodiel

    13. White Shadow says:

      @ Keyword-SEO-guy : I’m guessing those links use relative URLs, right? This is a bug in the plugin; I’m uploading a fixed version to wordpress.org as I write this.

      @ Asmodiel : Alright, though I’ll a bit differently 😛

    14. re: 809

      My ISP upgraded the CURL library. I checked the plugin’s debug info:
      PHP version 5.2.5
      MySQL version 5.0.41-community
      CURL version 7.19.5
      Snoopy Installed
      Safe mode Off
      open_basedir On
      Redirects may be detected as broken links when open_basedir is on.
      Lockfile /tmp/wp_blc_lock

      however. I see that open_basedir shows as on, but Support has denied that it’s actually turned on. They referred me to http://jade.rahul.net/~ldhesi2/info.php which lists config info for the server, in which I see that open_basedir has “no value”

      So the CURL issue is dealt with, but I’m not sure about the open_basedir situation, and meanwhile, I rescanned everything and there are no redirects showing.

      Thanks for your ongoing help with this!!!

    15. White Shadow says:

      Regarding open_basedir, the plugin just reports what PHP tells it. I’ll make it display the value it sees for the open_basedir setting, maybe that will provide some clues.

    16. Dingoe says:

      I noticed that your broken-link-checker is not internationalized. Please consider to do so, it’s not much work and might widen your range of fans ;-). I made a start by adding a domain name to your __(‘textstrings-to-be-localized’) and the 1 _e(‘textstrings-to-be-localized’) you have in your broken-link-checker.php page. Not all english terms are hereby translated though. You might want to look at the http://codex.wordpress.org/I18n_for_WordPress_Developers/ page.

      I uploaded the edited broken-link-checker.php, together with the broken-link-checker-nl_NL.po and mo file in a zip file to:
      http://rapidshare.com/files/294540358/broken-link-checker.zip

    17. gaianorm says:

      HI,
      I agree with dingoe, as I told you some weeks ago… i can also add Italian po file.
      byez
      G.

    18. re: 817

      Here’s what the debug info says now (after your update)

      PHP version 5.2.5
      MySQL version 5.0.41-community
      CURL version 7.19.5
      Snoopy Installed
      Safe mode Off
      open_basedir On ( /home/portigal/:/tmp:/usr/local/lib/php/ )
      Redirects may be detected as broken links when open_basedir is on.
      Lockfile /tmp/wp_blc_lock

      Interesting (to my naive self) that the open_basedir is giving a different readout here than http://jade.rahul.net/~ldhesi2/info.php which says “no value”

    19. White Shadow says:

      Interesting, yes.

    20. I was able to check /usr/local/lib/php.ini

      [relevant lines, via grep, but I can get more of the file if need be]

      ; open_basedir, if set, limits all file operations to the defined directory
      ;open_basedir =

      So there’s no value set there. But I suppose something else could be changing the setting – another plugin, something in WP, etc. I don’t really know what it is or if that’s even possible, but I wonder if that’s a source for investigating?

    Leave a Reply