web

Moving a WordPress site to a static website

For years WordPress was the obvious choice for almost any website: a blog, a company page, a portfolio, a small shop or a site for a local club. You install it, pick a theme, add a couple of plugins and you are done. But it’s no longer the best solution in the AI era where it’s easy to build a website from scratch and with growing security concerns regarding PHP and Wordpress.

Why get rid of WordPress?

Security. WordPress is still the most popular CMS in the world, so it’s also the most popular target. New vulnerabilities, come out all the time, mostly in plugins and themes, but sometimes in core or even PHP itself like PHP2Shell (CVE-2026-109618 and CVE-2026-109619). Bots scan the whole Internet for wp-login.php, xmlrpc.php and known-vulnerable plugin paths. If you don’t update for a few months, sooner or later someone will find a way in.

Maintenance. All of that means constant upkeep: core updates, plugin updates, theme updates, PHP version upgrades, database backups, checking that an update didn’t break the layout… For a site where the content changes once in a while, that’s a lot of work just to keep the lights on.

Overkill. Most WordPress sites don’t need a database, a PHP runtime and an admin panel exposed to the Internet. The content is just text and images that change rarely. A set of static HTML files does the same job, is faster, cheaper to host, and have a much smaller server-side attack surface.

The thing that used to stop people from moving was the effort: you had to convert the content and then build a new theme from scratch. Today, with the help of AI, you can achieve a good-looking result in less than an hour.

Migration

Are you ready to migrate? Let’s go:

Step 1: Export the content from WordPress

In the WordPress admin panel go to Tools → Export. Select “All content” and click “Download Export File”.

You will get a single XML file (WXR format) with all your posts, pages, categories, tags and links to the images.

Step 2: Convert the export to Markdown

There is a great tool for this: wordpress-export-to-markdown. No installation needed, just run it with npx in the folder where the export file is:

npx wordpress-export-to-markdown

It starts a wizard that asks a few questions. These are the options I selected:

✓ Path to WordPress export file? mywebsite.WordPress.2026-09-20.xml
✓ Put each post into its own folder? No
✓ Add date prefix to posts? Yes
✓ Organize posts into date folders? Year folders
✓ Save images? All Images

The result lands in the output/ folder: every post and page as a Markdown file with frontmatter (title, date, categories, tags…) and all the images downloaded locally. It’s worth a quick look through a few files to make sure nothing important got lost, e.g. embeds or shortcodes from plugins. You can also remove elements/pages that you don’t need anymore.

Step 3: Let AI build the site

Of course AI could do also Step 1 and 2 by itself, but we save some precious tokens by doing the easy part by ourselves. Now the fun part. Open an AI coding agent (Claude Code/Codex/Antigravity/Opencode or whatever harness you’re using) in the folder containing output/ and give it a prompt like this:

I have a WordPress website at mydomain.com. It’s a [blog / company page / portfolio / …] about [what the site is about]. I’ve exported its content and converted it to Markdown with the wordpress-export-to-markdown package - the result is in the output/ folder. I want to replace WordPress with a statically generated site built with Astro. Don’t make it look like a typical AI-generated website. You can take inspiration from the current design of the site.

The last sentences are of course optional. If you like your current design or typical AI look, keep it, and the agent can look at the live site and keep the same feel. If you’d rather start fresh, drop it, or describe what you want instead (fonts, colors, “minimal”, “magazine-like” etc.).

Expect a few rounds of feedback. The first version is usually decent, and after a couple of “make the header smaller”, “move the contact info to the footer” requests it’s ready. Also ask it to keep the old URLs (or add redirects), so you don’t lose links from Google and other sites.

Why Astro?

There are many static site generators (Hugo, Jekyll, Eleventy…), but Astro, which is quite popular now, is a really good fit for a migrated WordPress site:

  • Content first. Astro has built-in content collections: you point it at a folder of Markdown files, define the frontmatter schema, and get typed data for your pages. The output of wordpress-export-to-markdown fits in almost as-is.
  • Zero JavaScript by default. Pages are rendered to plain HTML at build time. No JS is shipped unless you explicitly need it for a component, so the site is very fast.
  • Image optimization. Images used in your content are resized and converted to modern formats during the build.
  • Familiar and flexible. Components look like HTML with a bit of JavaScript on top. When you need something interactive, you can drop in React, Vue, Svelte etc. only where it’s needed.
  • Good ecosystem. Official integrations for RSS, sitemap, MDX and more, which covers most things you had plugins for in WordPress.
  • AI knows it well. Astro is popular and well documented, so AI agents produce working Astro code without much struggle.

Step 4: Build and deploy

When you are happy with the result, run the dev server to check everything once more:

npm install
npm run dev

It serves the site at http://localhost:4321 with live reload. Then build the production version:

npm run build

Astro generates the whole site into the dist/ folder: just HTML, CSS and images. You can preview exactly what will be deployed with:

npm run preview

The dist/ folder can be hosted anywhere that serves static files: nginx on your own server, GitHub Pages, Cloudflare Pages, Netlify, an S3 bucket… There is no database and no PHP to update, so after deployment there is nothing to maintain.

To add a new post or page, create a Markdown file, run the build and upload dist/ again. Even better, put the project in a git repository and set up CI (e.g. GitHub Actions) to build and deploy on every push.

Once the new site is live, don’t forget to remove the old WordPress installation and its database, otherwise it’s still a door left open.