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 :
- Download the .zip file (see below).
- Unzip.
- Upload the
broken-link-checker
folder to you/wp-content/plugins
directory. - Activate the plugin in the Plugins tab.
[…] Broken Links is available for install from the WordPress Plugins screen, or you can go straight to the source at w-shadow.com. […]
Every internal link gives me a 500 server error. I use the Quick Cache plugin and I’m thinking it’s the cause, although I don’t see why.
You can test that theory by temporarily deactivating Quick Cache and telling BLC to recheck a couple of those links. If they work fine, you’ll know it really was Quick Cache that was causing the problem.
I am writing a review on your plugin. This is great plugin, please read the review to let me know about the post.
Great plugin. I have one small issue, however, which is that every single internal link is reported broken, even though they are not. This includes relative links to other pages as well as uploaded images. It also includes links to 2 other WP installs on the same server under different subdomains, which makes me think that it might be something to do with the server config – it looks like it is not able to connect to itself, or something.
wp-cron also doesn’t work – I have had to schedule calls to wp-cron.php myself in the hosting control panel. Maybe this is related.
How would I go about diagnosing this? Is there a test script or something? The debug info in BLC doesn’t throw any errors, except for reporting a slightly old version of cURL.
I deactivated my cache and still have the internal links problem. Since I administer my own server, it’s pretty easy for me to check to make sure everything is in place. I even checked to make sure I had the latest cURL installed. Perhaps I need to review the code in your plugin to see if there’s something I’m missing.
In the meantime, I just told it not to check my domain in the advanced options.
The plugin doesn’t do anything special for internal links. It checks them the same way it does any other link. So if external links seem to get checked okay and it’s only internal ones that cause false positives, there’s indeed something in your server configuration or plugin collection that’s causing the problem. This applies to both of the previous comments.
You could take a look at the link log, perhaps it would provide some clues. The log is accessible by clicking the contents of the “Link Text” or “Status” column and includes HTTP header data from the last request the plugin sent to each link.
The log for each internal broken link simply says ‘no response’.
(I have tried the plugin with all other plugins disabled, with the same result.)
If you could suggest a diagnostic starting point, e.g. the lines of code that handle the HTTP call and the function used, that would be nice as I could try fixing it myself.
In the latest version of the plugin, the relevant code is located in /broken-link-checker/modules/checkers/http.php. See the check($url) method around line 326.
This is what it shows:
1. Log : === HTTP code : 500 ===
HTTP/1.0 500 Internal Server Error
Date: Fri, 13 Aug 2010 07:38:08 GMT
Server: Apache/2.2.12 (Ubuntu)
X-Powered-By: PHP/5.2.10-2ubuntu6.4
Expires: Fri, 06 Aug 2010 07:38:08 GMT
Last-Modified: Fri, 13 Aug 2010 07:38:08 GMT
Cache-Control: no-cache, must-revalidate, max-age=0
Set-Cookie: wp_ozh_wsa_visits=1; expires=Sat, 13-Aug-2011 07:38:08 GMT; path=/
Set-Cookie: wp_ozh_wsa_visit_lasttime=1281685088; expires=Sat, 13-Aug-2011 07:38:08 GMT; path=/
X-Pingback: http://www.untwistedvortex.com/xmlrpc.php
Link: ; rel=shortlink
Vary: Accept-Encoding
Connection: close
Content-Type: text/html; charset=UTF-8
Link is broken.
***
I have 4 blogs on the server and they all show like this.
Hmm, the “wp_ozh_” cookies there seem to indicate that the request at least reaches WP, but that’s all I can divine from these headers.
I was having the same internal link issue when I moved my content to a new server. DNS was causing my problem. I had to edit my host file to point to the internal IP address of my server. My crappy modem can’t do loop back so the links always failed. Once I edited my host file most links resolved them self. I am still trying to figure out why 39 links are still broken, I have a feeling it is a permission issue on the server, just have not had time to investigate further.
[…] Broken Link Checker: You know it and I know it and the search engines know it. Broken links suck. This plugin will check on your outbound links and notify you in the dashboard if you have a link that is broken, so you can update or delete it. […]
I fixed my internal link problems by forcing the plugin to use cURL instead of Snoopy. I edited /broken-link-checker/modules/checkers/http.php in order to do this so I will have to make the same edit when upgrading. Maybe there could be an option for it?
Any ideas why it didn’t pick cURL automatically? Technically the plugin is supposed to use cURL whenever possible. Snoopy is just a fall-back for servers that don’t have the cURL extension/lib installed.
[…] Broken Link Checker – Spits out all the broken links across your entire wordpress site. […]
Is there any way to show up in a post or on the widget area the Broken link checker widget?
No, not really. Why?
Thank you for the reply 🙂
In a blog where i’m admin, there are a lot of link of free services and every time i have to edit the post.
I manage a lot of social blog and in this case if the widget appear in the post the user will be prompted immediately and they know what link are down.
Ah, it looks like I misunderstood your first comment – I thought you were referring to the widget-enabled sidebar that most themes have. You actually meant that you’d like to display the widget in the post editor page, right?
Anyway, that’s not possible either, but it could be a good idea for a future enhancement. I’ll make a note of it.