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.



First, make sure you have the PublishPress Checklists plugin installed.

Valid Format
Valid Format

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:

Valid Format Red 1
Valid Format Red 1

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.

Broken Link Blocker
Broken Link Blocker

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

Valid Format Green
Valid Format Green

The Checklists plugin uses these regular expressions to check for broken links. You will find this code in this file: /core/Utils/HyperlinkValidator.php


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.

Leave a Reply

Your email address will not be published. Required fields are marked *