Some older WordPress sites no longer need editing, but their pages and URLs should stay available. Is there a way to turn them into static archives, and what would need checking before switching them over?
Is there an open-source tool for retiring WordPress sites without losing their content?
Answers
wp-static-archive is an MIT-licensed command-line tool built for this. It produces reproducible static HTML archives and aims to preserve published content, comments, media, permalinks, redirects and legacy query-string URLs. It also supports site-specific fixes for things like broken links and obsolete embeds.
It uses WP-CLI to enumerate published content, including unlinked pages and custom post types, then feeds those URLs to wget. The workflow is iterative: build a private candidate, inspect its reports, apply fixes and review it before deployment. Coding agents can help with the investigation, but the administrator still needs to review the result.
Reply to this answer
Static is great if the site is basically finished. Anything that needs server-side execution won't just carry on working, though. A contact form that sends mail through PHP would need to be removed, replaced with an email link or connected to an external form service.
Red Wagon:
So the archive needs a check for functionality as well as missing pages. That makes sense.
Reply to this answer
Keep a separate backup if you might want the WordPress site back in an editable form. The static archive isn't intended to be reversible. The tool doesn't modify the original installation or database, so those can be retained for a future restore.
Reply to this answer
Watch the private stuff before publishing. The tool can exclude password-protected posts and pages or preserve restrictions using HTTP authentication. It also inventories archived files and flags potentially sensitive material such as backups and database dumps. Review those findings rather than assuming every file belongs on the public site.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Walter:
Comparing the candidate with old server access logs could catch additional URLs that visitors still use. Content enumeration helps, but it doesn't make that comparison unnecessary.