How to Fix (Or Remove) Broken Links on Your WordPress Website
Have you found a link (or more) on your WordPress website that leads to the infamous “404” error? Try not to panic. This is actually very common – you’ve simply discovered a link that isn’t going where it’s supposed to.
Broken links – otherwise known as “dead” links – are as common as dandelions and can occur twice as frequently. The 404 error is your browser’s way of saying “Hey, this link is trying to take us somewhere… But there’s nothing here.”
Considering that the usability of your links is a large factor in your site’s credibility, keeping them valid is critical. You’ll also be happy to know that broken links are incredibly easy to fix. In fact, after reading this article, you’ll know what a broken link is, be familiar with some of the best link-checking tools out there, and know how to quickly fix or delete broken links with the Broken Link Checker plugin.
What Are Broken Links?
Unlike working links, broken links result in a 404 error when clicked. This is usually because they’re attempting to redirect visitors to a missing page or a non-existent resource.
They occur for quite a few reasons, but mostly when the link’s URL points to a domain that no longer exists, has unusual firewall settings, has been hacked or has failed to maintain proper hosting.
Alternatively, broken links sometimes occur when redirecting URLs are written incorrectly. A good example is a link with “google.com” as its URL:
What’s wrong with this? Actually, a lot.
You see, when the Google URL is typed this way, the browser is actually prompted to look for google.com on your site (something like http://www.yoursite.com/google.com). Whether you’re creating or fixing links, always remember to reference the full URL. You can do this by including “http://www” as well as the specific page you’re redirecting to (http://www.google.com/maps/ is a good example).
WordPress Link-Checking Solutions
Now that you can recognize broken links, you’ll want to identify and then either modify or delete them.
That may sound easy, but locating broken links is the most difficult part of the process. Your method for finding broken links will depend on the frequency of your posts and the density of your online content. If you have a smaller site, with only a handful of links, you can perhaps get by with manually testing them once a month and fixing them if they break.
Can you imagine digging in and searching through a gigantic site manually? For the sake of your own sanity, don’t. While painfully testing each and every link on a large site surely builds character, using a helpful link checking tool will allow you to plow through hours (or even days) of work in mere seconds. Not only will the right program save you time, there are a great number of WordPress link-checking options, and most of them are free.
Of course, you’ll need to weigh the benefits and pitfalls of the specific tools you’re considering before choosing. If you already have Google’s Webmaster Tools installed, you’re set up for crawlers to scan your site. If you prefer to initiate your own search, there are websites like iWebTool Broken Link Checker or Online Broken Link Checker that you can use to quickly scan your site.
Broken Link Checker
While certainly not the only option, Broken Link Checker is a well-regarded link checking plugin for WordPress.
Many appreciate the plugin’s routine scans, as well as how it organizes broken links into a user-friendly table, detects missing images, and flags missing YouTube videos. While the plugin doesn’t always play nice with others and some have complained about resulting load lag, the tool has been installed on 400,000 sites and counting.
It should be noted that the goal of this article isn’t to promote one plugin over another. To date, a variety of link-checking plugins can be found in the official WordPress directory. After reading this article, you may very well decide that another plugin is a better solution to your needs. But since the following link checking instructions can only demonstrate one plugin, the Broken Link Checker will serve as our example. Besides, it’s my favorite ;-)
How to Fix or Remove Broken Links with Broken Link Checker
Once you have installed and activated Broken Link Checker, it will busy itself with scanning your site. You can check the scan’s progress by navigating to Settings > Link Checker from the WordPress dashboard:
You can change a number of settings from this same page, including the following:
- Change the frequency at which existing links are checked (new links are checked immediately).
- Set email notifications for broken links.
- Apply custom formatting to broken and/or removed links.
- Stop search engines from following broken links.
You can manage more advanced settings from the Advanced tab.
When you’re ready to fix some links, click the link at the top of the plugin window that says Found (x) broken links. The actual number will determine how many broken links you currently have.
You’ll be presented with a list of links, like this:
There’s a lot of information to take in here, but the interface is pretty intuitive. From left to right you have the URL of the broken link, the status of the broken link, the anchor text of the broken link, and the source (i.e. the page, post or comment on which the broken link exists).
1.6 million WordPress Superheroes read and trust our blog. Join them and get daily posts delivered to your inbox - free!
Dealing with broken links is a piece of cake. Simply hover over a URL and your options will appear:
The options on here are pretty self-explanatory:
- Edit URL: Edit (i.e. correct) the URL.
- Unlink: Delete the link (but retain the anchor text).
- Not broken: Mark the link as not broken (it will disappear).
- Dismiss: Hide the link (it will be relegated to the Dismissed category).
- Recheck: Recheck the URL if you believe it will now be fixed.
That’s all there is to it! Cycle through the links, taking the appropriate action as you see fit.
There’s plenty more this plugin can do, but in the spirit of the Pareto Principle, I want to share one particularly useful tip with you.
In my experience, the majority of broken links come from the comments section – typically in the form of broken links to commenters’ sites that were entered incorrectly, or simply no longer exist. And while you’ll want to be more discriminate in unlinking, fixing or removing links within posts and pages, you may not feel the need to navigate through tens (or hundreds) of broken links within comments. So rather than wasting your time going through each individually, you can use Broken Link Checker’s filtering feature to Unlink them all in one fell swoop.
Start by navigating to Tools > Broken Links from the WordPress dashboard, then click on the Search » button:
Select Broken from the Link status drop down box, and Links used in Comments from the Link type drop down box. Then click the Search Links button, and hey presto! You’ll have a list of broken links contained within comments only.
If you’re anything like me, you will have a lot of these. That being the case, before you bulk delete the broken links, click on the Screen Options tab and increase the Show on screen number to match or exceed the number of broken links:
Click Apply when you’re ready. This may take a moment or two if you choose a high number (my 260 took a couple of seconds).
All that’s left to do now is zap those broken links! Just select all posts by clicking the ‘master’ checkbox at the top of the list…
…Then select Unlink from the Bulk Actions drop down box and hit the Apply button. You’ll be presented with a confirmation box that you’ll need to agree to.
Then wait. This may take a few moments – the plugin’s got some work to do. But once it’s finished, you’ll be presented with a simple confirmation screen:
Hey presto! Bulk removal FTW.
If you’ve followed along to this point, you now know how to locate, recommission or altogether scrap broken links.
While there are many options for finding broken links, plugins that enable you to schedule scans are probably preferable to link checking sites where you’ll need to initiate the process. Automatic and scheduled checks are vital because links can and probably will die when you’re not expecting them to. What’s more, after investing just a little of your time to set up an automated plugin, you won’t have to even think about your links until you receive an e-mail notification that they aren’t working.
While keeping your links functioning probably won’t get you oodles of praise, we’ve all been on sites where links to vital information can’t be accessed. Strive to be better than that. And remember, the time and attention you put into maintaining your links isn’t just improving your site. It’s laying the groundwork for a valuable visitor experience.
How do you track and remove your broken links? Do you have any questions? Fire away in the comments below.