WpBrokenPy is a simple and powerful WordPress broken link checker that you can run in command line. It is basically a Python script that takes domain and CSV file name from you and saves the output. This script is basically using WordPress API to get all the posts and scan the entire website for broken links. All the broken links with 404 and other errors are recorded, and you can see the statistics in the final file.
It creates a CSV file in the end that has columns post ID, post URL, broken link, and its status code. It primarily looks for 404 errors but if a URL in some WordPress posts generates different errors, then it records that as well. This is a multithreaded script and can crawl thousands of pages in a matter of hours while other software that generally use crawling can take up an entire day or more for the same task.
There are popular link checkers such as Screaming Frog and SiteBulb but they use traditional crawling to scan a website for broken links. Crawling can be a long process and not system efficient as well as it can slow down a PC. And if want to scan a WordPress website then you can avoid crawling. Just use the API and that is what this script here does.
The WpBrokenPy is multi-threaded script and goes through each post one by one. It extracts all the URLs from the posts and then checks their HTTP status code. URLs or links with 404 code are recorded and added to the CSV file. If you know programming then you can make some changes in the script to ignore or include specific HTTP status codes.
Free WordPress Broken Link Checker for Command Line: WpBrokenPy
All you need Python installed in order to run this script. You can run it on Windows, macOS, and Linux with ease. Just run a simple command and it will take care of the rest.
So, install Python first and then after that open the terminal with command prompt or PowerShell. Run the following command to install the necessary modules and library.
pip install requests bs4
Now, you can start the script. Download it from here and then extract it. You can place it in any folder on your PC.
Navigate the prompt of PowerShell or CMD to the folder where you have moved the script file. Run the script in the following syntax. On the CLI, you will see the number of pages available to scan and it will show you link of each post on the command prompt.
python WpBroken.py Domain CSV_Filename
python WpBroken.py finsite.tk finsite.csv
After the scan is completed, you will see that it will create a CSV file with the name that you supplied before scanning. You can open the CSV file and you will see the report in it. In the report, it will show you the post link, broken link, WordPress ID of the post, and status code.
In this way, you can use this script to scan any WordPress website and find broken links like a pro. I tried it in a WP website having around 3000 posts and 10-15 URLs in each post. It took around ~40-45 minutes and report that it generates was pretty accurate. You can run it again in the same way to scan more WordPress websites with ease.
If you are looking for a fast as well as free tool to scan your WordPress website for broken or invalid links, then you are at the right place. Just run this script and I am sure it will not disappoint you. Best part is that it doesn’t put any impact on PC performance. You can run it and minimize the command window and proceed on your work.