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 :

896 Responses to “Broken Link Checker for WordPress”

Pages: « 1 2 3 [4] 5 6 7 8 9 10 1130 » Show All

  1. 87
    White Shadow says:

    I guess there’s some kind of JavaScript conflict (Prototype vs JQuery). I’ll see if I can find it.

  2. 88
    onews says:

    I move my data to new host and lot of images links missing, thank to Broken Link Checker that solve my problem, thanks author for your great job.

  3. 89
    Carl says:

    Great plugin. Found a bunch of false positives, all of which are links to wikipedia, but a couple other links that were actually broken. Well worth the trade off of occasionally getting a false positive.

  4. 90
    NewMexiKen says:

    175 and counting (but I have > 12,000 posts going back 4-1/2 years).

    I’m certain I’m just missing it, but I can’t find where I “can set a different time period.” Not that I want to, I just wondered.

    Also I don’t see the strike out, which is cool, documented. Am I just missing that too?

    Good work. Thanks.

  5. 91
    White Shadow says:

    All of the options are found under Options -> Link Checker (or Settings -> Link checker if you have WP 2.5).

    The “time period” option is on that same page and is called “Check Every Post Every [X] hours”. To get the strikethrough effect you need to enable the “Broken Link CSS” option, too (I think it should be on by default) and, if you have any caching plugins, make sure the cache is refreshed.

    That should do it :)

  6. [...] plugin-nya Broken Link Checker, pekerja keras yang akan mengecek semua artikel blog kita dari tautan rusak dan gambar hilang, dan [...]

  7. 93
    jez says:

    I get Error: Couldn’t update the post (DB error)
    on almost every second thing I want to “unlink”.

    besides, great plugin!

  8. 94
    White Shadow says:

    jez, I don’t see anything in the code that could cause this. In fact, you should never see that error message, except when the post containing the link no longer exists at the moment you click “Unlink”.

    I’ll make the error reporting a bit more verbose in the next version, but that’s all I can do for now.

  9. 95
    jez says:

    I do now get “Error: Couldn’t update the post” (with the brand new version)

  10. 96
    White Shadow says:

    If you really have the new version there should be a more detailed error message in parentheses after the basic message. Or just empty parentheses if the error was that there is no error ;)
    Eh, I don’t know.

  11. 97
    Jandry says:

    Hi, Great plugin. But it seems not to be working with wikipedia links.
    The following link is detected broken
    http://fr.wikipedia.org/wiki/Jackson_Richardson

  12. 98
    Abi says:

    Hi

    I spoke to my host and figured why i was getting error500 with this plugi. they say they do not support AJAX at moment ???? Thing is the plugin did use to work, can i revert back to an old version. Is AJAX for recent versions? I am puzzelled. All i know is it used to work and the host are saying that they have never allowed AJAX so they dont know why it did? Can you advise pelase ?

    Thanks

  13. 99
    White Shadow says:

    @Abi : The plugin has always used AJAX, since the very first version. I also find it highly unlikely that your host “doesn’t support AJAX”. After all, AJAX isn’t something that you need to enable or install server-side. Anyway, you could try to install an older version of the plugin and see if that works. You can find the previous versions here.

    @Jandry : I’ll check the link on my blog. We’ll see how this goes.

  14. 100
    jez says:

    I can confirm the wiki issue.

  15. 101
    Abi says:

    Right this is strange, i went all the way back to original version and uploaded it and it worked fine. No error 500 so i thought i would test for you all way through to see what version broke. I got all the way to the newest version which is now appearring to work fine so far??? In doing this i completely deleted the borken links directory before uploading the new version? Has this had anything to do with it now working?

  16. 102
    White Shadow says:

    To be honest, I don’t know. Maybe some of the plugin files were corrupted and reinstalling fixed it. Or maybe it’s the full moon that makes it work :)

    @Jez, Jandry : The Wiki link works on my blog. Maybe Wikipedia is blocking automated access from your site (some sites tend to do that).

  17. 103
    Blaenk Denum says:

    Hey White Shadow, first of all thanks for the plug in! The only problem is I have 160 broken links (I changed my domain name…heh) and so it becomes a hassle having to click ‘Edit Post’ for each broken link and search for the link within the post. I’m sure the majority of the people if not everyone using your plugin have around the same amount of broken links if not more, after all if it weren’t that many they wouldn’t have a use for this plugin in the first place.

    For this reason I’m wondering how feasible it would be to implement a feature with AJAX where, within the broken link list, one can click the broken link URL or something and it becomes a text box, and then once someone clicks outside of the box or a button, it changes the link that way. It would be tremendously helpful. I would do it myself but I’ve no AJAX experience let alone Javascript experience (I just occasionally hack away with my knowledge of other languages). However if you do (And I really hope you do) choose to try to implement this, I would be glad to test this it for you if you need testers. Just wondering if you’ve ever thought about that, I’m positive everyone using this plug in would benefit from this.

  18. 104
    White Shadow says:

    My AJAX experience is a bit limited, but the idea seems doable and useful. I’ll add it to my “idea file” (aptly named arrgh.txt), though I make no promises as to when it’ll be implemented.

    You see, if I immediately went after every suggestion I get for my programs, scripts and plugins, I would never get anything new done (well, I do usually fix reported bugs ASAP). So it might take a while for me to get around to it. I’m sure you understand ;)

  19. 105
    Blaenk Denum says:

    Yeah I do, maybe in that time I’d have learned AJAX and done it myself :P But I’m glad you think it’s a good idea anyways and have added it to your todo list, though I’m curious as to how you couldn’t have thought of it before :P Really though, it’s obvious that it would make your plugin truly complete. Thanks for the consideration!

  20. 106
    White Shadow says:

    Complete, you say? Ah no, not even close. To be “complete” it would need to do at least the following :
    * Also check for missing CSS files.
    * And missing JavaScript.
    * Check blogroll links.
    * Check links in comments.
    * Actually, check all links.
    * Have a link checking function that doesn’t trigger any bot detectors.
    * Gracefully handle “soft” 404 – when a site doesn’t send the expected 404 Not Found HTTP response, but displays a search page or something like that instead.
    * Work without CURL (for compatibility).
    * And so on (ad infinitum?).

    There are always more ideas than there is time (or enthusiasm, or skill) :P

  21. 107
    Blaenk Denum says:


    * Also check for missing CSS files.
    * And missing JavaScript.”

    I understand your enthusiasm but this doesn’t necessarily have to be in a broken LINK checker, as broken link checker implies hyperlinks, nevertheless it would be a great feature.

    Really though, not trying to nag you or anything, but wouldn’t this be a simple thing to do? Just take a look at the code in 2.5 that handles the following: when you go to write a post, it automatically generates a post slug under the post title. You can click on this slug and it’ll turn into a box with which you can change the post slug. Just use this same code to do the box thing. Then in the manner that you found the link within the post (Regex? Or did you hook onto a WP function? I’ll look at the plugin code later), change the link within the post.

    I might try and hack something together later, I’ll give you whatever I could come up with, if anything.

  22. 108
    White Shadow says:

    It’s regexps + some hooks to know when a post if modified. You’d probably need to access the DB directly to modify a post (there’s probably an internal function for that, but I’ve found the documentation pretty spares in this regard).

    I have a general idea of how to do the box thing at the moment… And sure, feel free to send me any code you might come up with.

  23. 109
    Alexey says:

    Thank you very much!

    This is a great plugin and made possible to for me to check and fix more than 3000 pages with 9000 links.

    Is there a possibility to start it as cron job?

  24. 110
    White Shadow says:

    Not in the current version, but if you know PHP, it should be pretty easy to modify wsblc_ajax.php to work with cron. You’d need to slightly modify it so that wsblc_ajax.php?action=run_check doesn’t require the user to be logged in.

    I’m not going to add official cron support to the plugin because many users don’t have the option to use cron.

  25. 111
    Alexey says:

    Thank you a lot! I will do it with wsblc_ajax.php. Have a nice weekend!

  26. 112
    Bert says:

    Hello,
    First off thank you very much for writng this plugin, great idea! The plugin was working great. But now the pages are not redirecting. In Explorer the pages gets hung up indefinitely, in Firefox it gives this error.

    The page isn’t redirecting properly
    Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
    * This problem can sometimes be caused by disabling or refusing to accept
    cookies.

    Any ideas of what could have happen? Are there plugins not compactable with Link Cloaker?

    Thank you VERY MUCH for your time.

    Bert

  27. [...] using any widgets, but… I am using a few plugins: the Broken Link Checker and the Dashboard Widget Manager. (The latter let’s you clear stuff you don’t want to look at out [...]

  28. 114
    D.J. says:

    At what interval does it check ? I have it set to 5 seconds for how long it checks, but my blog slows way down for a page request when it is running. If I could set this plugin to run for 5 seconds once every 60 seconds that would be great. This page slowdown is only there when the plugin is active and I’m in the admin panel. I think.

    I broke my site during the wp2.5.1 upgrade, reloaded and now the database links have shuffled. So I probably have many broken links or static links that go to the wrong post. I had deleted old posts here and there, and when I reuploaded the database backup, mysql redid the post numbers filling in the blank spots.

    Thanks,
    D.J.

  29. 115
    White Shadow says:

    The option that you can set is how often the plugin is invoked (how often it runs). So if you have it at 5 seconds, it will
    1) start up every five seconds (launched by JavaScript from the admin panel)
    2) run for five seconds (approximate)
    3) repeat from 1. while there are links to check
    The intention is to use all the alloted time, so in an ideal case the plugin will run continuously – until there are no more links to check.

    If it slows down you dashboard too much, try setting it to very long intervals instead.

  30. 116
    D.J. says:

    thanks, I’ll try that.

Pages: « 1 2 3 [4] 5 6 7 8 9 10 1130 » Show All

Leave a Reply