Broken Link Checker Plugin Version 0.3

I’ve gotten some interesting feature suggestions for my link checker WordPress plugin since I released the last version several months ago. During the last week I finally got around to implementing some of them. Enjoy 🙂

What’s New

Making broken links look different
There’s now an option to add a “broken_link” CSS class to known broken links. In the default configuration this will simply add a strike-through effect to the links. If you know CSS, you can define your own style in the Options -> Link Checker tab, or in your stylesheet. The style is only applied when a post is displayed, so your posts won’t actually be modified.

Exclusion list
Links that contain (in the URL) any of the excluded words won’t be checked. You can also add domain names or complete URLs to the list. Note that this doesn’t affect links that already show up as broken. If you want to permanently hide some of those, update the exclusion list accordingly and “discard” the broken links.

Remove broken links without editing the post
The list of broken links (Manage -> Broken links) now has a new button for each link – “Unlink”. It will remove all instances of the broken link from the post, but will leave the link text intact. So “a link” would turn into “a link”. This doesn’t work for missing images though.

Get the Update

Download : broken-link-checker.zip (~9Kb).
Or, if you have WP 2.3.x, use my Single Click Plugin Updater to upgrade the link checker plugin 😉

Related posts :

52 Responses to “Broken Link Checker Plugin Version 0.3”

  1. Lucas Cepeda says:

    Thank you, danke schön, gracias!! 🙂
    I love the “Unlink” button!

    Perfect plugin.

  2. Robert Wade says:

    Why does it say a link is broken when in fact it is not? I have a few links that it said were broken, but they are not broken and they go to the linked website they are supposed to?

  3. White Shadow says:

    There’s no way to answer that without knowing what the links are, but here are some ideas off the top of my head :

    * The linked website was down for a short while exactly when the link was checked. Seems unlikely, but it does happen.

    * The link works, but returns an incorrect HTTP response code. It might show a page correctly, but return a “404 Not Found” error in the HTTP header. For example, due to some WP issue I haven’t been able to track down yet, a page on this blog behaves like that.

  4. Robert Wade says:

    Ok, here is the page link I get when I click on view for one of the two that consistently come up: http://cyclejockey.com/?p=48. The page that link is on is actually, http://cyclejockey.com/?page_id=48. The link that it is saying is broken is, http://lwa.pryzm.net/lwa/. The link always works.

    The page it shows when clicking on “View” is a 404 error page, and it appears that it is because the page URL is not correct for what it should be.

    I have one other link that does this all the time. I can click on “Edit Post”, do nothing but save and they go away, but when it checks again, those two come up every time.

    I did not post the other link because it acts exactly the same.

  5. White Shadow says:

    I’ll fix the “View” links, but I can’t find anything wrong with the http://lwa.pryzm.net/lwa/ URL. I added it to a post on my test blog, and it doesn’t show up as broken. I looked at the headers and the link actually redirects to http://lwa.pryzm.net//lwa/default.aspx?AspxAutoDetectCookieSupport=1 . Which should be fine & works for me. Hmm.

  6. Robert Wade says:

    That’s weird that it did not show up broken on yours, but does on mine.

    By the way, I really like your Broken Link Checker. For now, I have disabled the style for lining through broken links.

  7. Robert Wade says:

    Now this is weird. On the Link Checker Options, I told it to Recheck All Pages, and it says there were no broken links found. There are 2 links specifically that I know are broken and those showed up before.

  8. White Shadow says:

    Hmm, what version of WP do you use?

  9. Robert Wade says:

    I am using the latest release 2.3.3. I however, failed to realize when I posted the last comment that it took a while for the re-check to start. It is running and is showing 8 broken links, but all of them are working links. I am wondering if the “View” links thing you mentioned you would fix is what is causing these valid links to show as broken in the checker?

  10. White Shadow says:

    I doubt it.

    The “View” links probably didn’t work for you because I used the default post-permalink format for them (which works in most cases, even if the user has set up custom “pretty” permalinks). Now I changed it to pull the proper permalink from the database and use that. I’ve already uploaded the update to the wordpress.org database.

    Maybe it’s something in your server configuration? I don’t know; if it was happening on this blog, I’d add some debuggin instructions to the plugin and start tracing the checking process to see what goes wrong… but that’s a very tedious thing to do if you’re not a PHP enthusiast 😛

  11. Georg S. Adamsen says:

    The Options->Link Checker page status says: “Found 20 broken links
    0 posts and 918 links in the work queue.isset($parts[‘user’])) { $url .= $parts[‘user’]; if(isset($parts[‘pass’])) { $url .= “:”.$parts[‘pass’]; } $url .= “@”; } if(isset($parts[‘host’])) { $url .= $parts[‘host’].”/”; } $url .= $path; return $url; } ?>”

    It’s the new 0.3.1. Everything looked fine in the pre-0.3-version.

    Any suggestions?

  12. White Shadow says:

    This is… quite unusual. That code is indeed from the plugin, but I have no idea how it could get there – except for the plugin files getting somehow corrupted. Try reinstalling the plugin and see what happens.

    Personally, I’ve got the 0.3.1 running on two blogs and I haven’t seen anything like this.

  13. Robert Wade says:

    On mine, the “View” action is correct now. I am still getting a lot of links that are saying they are broken and they are not. A couple consistently show up, but all the others are random. Even a couple image links that are on my host.

    My only question has to do with the amount of time, it waits until a link is determined to be broken. What is this set at? Maybe for my case, I might need to change that and make it a tad longer.

  14. White Shadow says:

    It waits 15 seconds for a connection to be established, and no more than 25 seconds in total (connection + data). These values are hard-coded, so if you want to change them open wsblc_ajax.php and look for lines like these :

    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15);
    curl_setopt($ch, CURLOPT_TIMEOUT, 25);
  15. Georg S. Adamsen says:

    I have tried uninstalling. I managed to get it to work at http://www.revelation-resources.com, but I run a number of Danish blogs that share the same plugin files but run on different subdomains. See, e.g., http://naestesoendag.blogos.dk/

    I was afraid that I forgot to deactivate the plugin before uninstalling on the English blog mentioned above, but I did check carefully to ascertain that all nine blogs that share the same plugin files were deactivated. And I only activated one account in order to check whether the 0.3.1 functions on my installation. 2.5 did functions without problems.

    It is exactly the same code that shows up again, both on my English installation on a separate domain that has its own set of plugin-files and on my Danish installations that run the same files.

  16. Georg S. Adamsen says:

    Oh, by the way, it seems as though one cannot downgrade from 0.3.1 to 2.5. Does 0.3.1 use the database in a different way?

  17. White Shadow says:

    I think both version have the same database structure, but there might be some small differences in how they handle saved options.

    Unfortunately I have no helpful ideas at the moment :/

  18. Robert Wade says:

    I changed the timeouts to 25 and 35 respectively. It has taken care of all the wrong broken links except for the two that always showed up, one of which being the one I mentioned earlier.

    I may try changing the timeouts again, but am not sure that will help. Do you have any other ideas?

  19. White Shadow says:

    Add them to the exclusion list and don’t worry about it? Eh, I don’t know 🙂

  20. Georg S. Adamsen says:

    Broken Link Checker-problem

    The code that shows up (see above) is displayed in IE 7 (fully updated), Firefox 2 (latest stable version) and Opera 9.26 (latest stable version).

    It is displayed on the Options–>Link Checker page as well as in the Dashboard.

    It is displayed in three different themes, incl. the standard WP 2.3.3 (Danish) theme.

    I cannot find any errors in the MySQL-database.

    Is there anything in the code that may require an English WP 2.3.3?

Leave a Reply