- Ported script to use
httpx
instead ofrequests
. Try that here: WpBrokenCheckx.py - This version of the script is 15% faster as well 🥳🚀
This is a simple Python script you can use to find out broken links on a WordPress website. It uses WordPress's API v2 to get all the published posts and scans all the links inside including internal links, external links, attachments, images, etc.
At the end, it saves a CSV file in the current working directory. By default, all the links are stored in the CSV file. Later, you can filter them using Excel or LibreOffice.
- Install Python
- Install Poetry
- Run
poetry install
- Run as
poetry run python WpBrokenCheck.py [Domain] [CSV_FileName]
- Example:
poetry run python WpBrokenCheck.py example.com example.csv
Note : Only type domain without http:// or https://
Tip : If target website has large number of posts then change max_workers
from 5 to 10 at line 60.
There are the following Python linters:
- black for code formatting
- flake8 code formatting and line brakes (PEP8)
- isort for reordering imports
They are run via pre-commit as you commit the code to the repository. You can also run it manually on all files by:
pre-commit run --all-files
- Make it filter specific codes.
- Make it run on customized WP sites
Push binary releases
PRs and suggestions are welcome :)