How to Check for Broken Links in WordPress Posts
If you write a lot of WordPress posts, it's easy to make mistakes. That's why we built the PublishPress Checklists plugin. It automatically catches many of our errors before we publish.
In this post, we'll introduce a feature in PublishPress Checklists that checks for broken links in your content (both external links and internal links).
This feature won't check the destination URL, but it will check the link format to make sure you haven't used URLs such as htpps//
or .nt
.
Video guide to the broken link checker
How to use the broken link checker
First, make sure you have the PublishPress Checklists plugin installed.
- Go to Checklists > Settings. The image below shows the internal links option.
- You can choose from “Disabled, Recommended, or Required” options.
- You can choose “Who can ignore this task?“

If you enable this link validation option, it will be visible when you edit content.
If you have broken links in your content, this task will be marked in red in the sidebar:

If you do have broken links, you won't be able to publish the post. The “Publish” button will be hidden with a red warning sign.

If you do not have broken links, this task will be marked in green in the sidebar:

Technical details for the link validation
The Checklists plugin uses these regular expressions to check for broken links. You will find this code in this file: /core/Utils/HyperlinkValidator.php
Other link features in PublishPress Checklists
With PublishPress Checklists, you can require a maximum and minimum number of internal links in your WordPress posts. We use here at PublishPress. A large number of internal links is helpful for search engine optimization.
You can also require a maximum and minimum number of external links. This is helpful because too many external links can harm your site's search engine optimization.