Skip to content

Instantly share code, notes, and snippets.

@plembo
Last active July 15, 2023 01:21
Show Gist options
  • Save plembo/6d20e62059de74b3cd1d291f4cffb0ca to your computer and use it in GitHub Desktop.
Save plembo/6d20e62059de74b3cd1d291f4cffb0ca to your computer and use it in GitHub Desktop.
Converting a WordPress site to static HTML

Converting a WordPress site to static HTML

There are many suggested solutions for this, once you get past the incessant finger-wagging by generations of StackOverflow moderators that the question is "outside the scope".

I have tried a few, most do not work.

Using wget seems to work if you target a specific page (which is all I needed for my project):

wget -r -p -e robots=off http://site.example.com/anotherpage

This brings back the page targetted (without any extension) as well as an index.html for the site home page.

Using just the root url alone only brings back the home page.

Both methods also download some assets from wp-includes and wp-content (images and versioned javascript files). None of this material

Note: If you are trapped on Windows, you can get wget for Win32 from https://eternallybored.org/misc/wget. I use it by copying the wget.exe binary to %HOMEPATH%/bin and then accessing in a Git for Windows session where my $PATH includes "$HOME/bin", as I can't stand the Windows shell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment