Mirroring a WordPress blog for offline viewing

I’m making a note of this for my own future reference.

As a premise, you need the blog to have pretty permalinks. There might be a way to make wget handle those http://site.com/blog/?p=123 -type URLs so that they can be viewed offline, but for me the easiest way around this was to simply switch to the Day and name option in Settings → Permalinks. That way individual posts will have URLs ending in slashes, resulting in the content being saved to a good old index.html inside a subdirectory, in the local copy.

So obviously, if you’re mirroring someone else’s blog, whose settings you don’t have access to, and which doesn’t use pretty permalinks, you’ll have to find another way to make the downloaded filenames work.

Otherwise, you’re good to go: fire up wget like this:
wget --convert-links --mirror --no-parent --no-host-directories http://site.com/blog/