Migrating WordPress to Astro: Content Export, URL Mapping, and What Breaks
26 November 2026 · Updated 28 November 2026 · 15 min read · by Yang Kai
Migrate WordPress to Astro step by step: inventory, WXR export and Markdown conversion, SEO metadata, the redirect map that protects your traffic, launch checks, and fixes for what breaks.
Template inside: WordPress-to-Astro Migration Checklist + Redirect Mapping Table Template
Contents
- What you need before you start
- Step 1: Inventory before export
- Step 2: Back up, then set a content freeze
- Step 3: Export WordPress and convert to Markdown
- Step 4: Set up the Astro project and validate the content
- Step 5: Move the media — and keep the addresses that matter
- Step 6: Carry the SEO metadata over — deliberately
- Step 7: Build the URL map and the redirects
- Step 8: Replace what the plugins did
- Step 9: Rebuild the design — do not replicate it
- Step 10: Launch, then watch the URLs
- Troubleshooting: the failures that actually happen
- The migration checklist
- How we researched this
- What to do next
Most WordPress-to-Astro migrations that go wrong do not fail at the rebuild. They fail at the edges: a category of URLs nobody redirected, SEO titles that lived in a plugin and never made the trip, images still pointing at a WordPress install that no longer exists.
This guide is the full sequence, in the order that prevents those failures: inventory, backup, export and conversion, metadata, media, the redirect map, feature replacements, staging checks, and launch. It assumes you have already decided Astro is the destination — if you have not, the content-site comparison with Next.js covers that decision first.
The short version: export the content to Markdown, rebuild the design as an Astro theme, and map every old URL to a new one. The URLs are where your search traffic and other people’s links live, which is why the map gets its own step before any design work.
What you need before you start
- WordPress admin access to the live site, plus a full backup (files and database) stored somewhere that is not the server you are leaving.
- The old site staying live until launch day. The converter downloads images from it, and you will check old URLs against it throughout.
- Node.js installed locally — the conversion tool and Astro both run on it.
- A staging URL (a free preview deployment is enough) where the new site can be read and tested before the switch.
- A spreadsheet for the redirect map. It starts in Step 1 and is finished before launch, not during it.
- Time, sized by the inventory in Step 1. A 30-post blog is a weekend. A 500-post site with a page builder is a data-cleaning project with a website attached.
Step 1: Inventory before export
Exporting first and asking questions later is the classic mistake. Spend an hour inventorying what the WordPress site actually is:
- Content counts by post type — posts, pages, and any custom post types (portfolio items, testimonials, products), because each type becomes its own collection or gets consciously dropped.
- The URL list. Export or crawl a complete list of current URLs, including category and tag archives if they receive traffic. This list is the raw material of your redirect map, and you cannot reconstruct it after the old site is gone.
- Active plugins and what each one does for visitors — forms, galleries, SEO metadata, memberships, e-commerce. Every plugin is a feature to rebuild, a service to embed, or a feature to retire, and the decision belongs in the plan, not during the rebuild.
- Media volume. Years of uploads folders are usually far larger than the images actually used; the inventory tells you whether media migration is an afternoon or a project.
You should now have: four lists — content counts, every URL, every plugin with a disposition, and a media estimate. Every later step works from these.
Step 2: Back up, then set a content freeze
Take the full backup first, while nothing is mid-change. Then pick the freeze: the moment after which nobody edits the WordPress site, so the export you convert is the export that launches.
Small sites can freeze for the whole migration. Active sites freeze at the end instead: migrate a first export, build everything, then run a short delta export of anything published since, just before launch. Either way, the freeze is a decision made now, in writing — migrations that skip it end up reconciling two moving versions of the truth.
You should now have: a restorable backup and a freeze date everyone publishing to the site knows about.
Step 3: Export WordPress and convert to Markdown
In the WordPress admin, go to Tools » Export, choose All content, and download the export file. WordPress calls this format WXR: one XML file holding posts, pages, custom post types, categories, tags, authors and comments.
Convert the WXR file with wordpress-export-to-markdown, the open-source converter that Astro’s official migration guide points to. Run it in the folder holding the export:
npx wordpress-export-to-markdown --input=export.xml --post-folders=false --save-images=all
It writes one Markdown file per post, with frontmatter you choose — ask for title, date, slug, excerpt, categories, tags and a cover-image field — and it downloads the images each post actually uses. Two settings decide whether the conversion is clean:
- Set the timezone to your site’s timezone (the one under Settings » General in wp-admin). The converter defaults to UTC. A post published at 23:30 local time otherwise lands on the next day — and if your permalinks contain the date, its URL changes with it.
- Ask for flat files named by slug, with the slug also in the frontmatter. Step 6 uses that slug to keep every URL exactly as it was.
Expect a cleanup pass afterwards. Shortcodes become stray bracketed text. Page-builder content may export as dense HTML blobs. Posts written by five editors over eight years carry five eras of formatting. Budget for it honestly; this pass, not the tooling, is where large migrations spend their time.
Note: A second route exists for very large or frequently updated sites: pull content from the WordPress REST API (/wp-json/wp/v2/) with your own script. It gives you field-level control at the cost of writing the converter yourself. Most sites should take the WXR route.
You should now have: one Markdown file per post and page, images downloaded beside them, and a short list of files flagged for manual cleanup.
Step 4: Set up the Astro project and validate the content
Start from Astro’s blog template (npm create astro@latest -- --template blog), which arrives with a layout, RSS feed and sitemap already wired. Copy the converted posts and pages into collections under src/content/.
Define the schema in src/content.config.ts to match the frontmatter the converter wrote — title, date, slug, description, tags — so content collections validate every file at build time. This is the migration’s quiet superpower: a post with a broken date or a missing title fails the build with the filename attached, instead of shipping as a quietly broken page. Fix what the build reports; that list is your cleanup pass, made explicit.
You should now have: a building Astro project in which every migrated post renders, and a build that complains by name about anything malformed.
Step 5: Move the media — and keep the addresses that matter
The converter has already downloaded the images your posts use and rewritten their references. Two decisions remain:
- Images used inside posts belong in
src/assets/, where Astro’s image pipeline optimises them at build time. This is the default for anything the converter fetched. - Images with their own audience — ones that rank in image search, or are hotlinked from other sites — keep their old addresses instead. Copy the relevant part of
wp-content/uploads/into the Astro project’spublic/folder under the same path, so/wp-content/uploads/2023/05/chart.pngkeeps answering at exactly that URL. It looks untidy and it protects traffic you already own.
Unused uploads — the other eight sizes of every image, the abandoned drafts — do not migrate. The inventory from Step 1 is what lets you abandon them consciously rather than by accident.
You should now have: every referenced image loading on the staging site, and a deliberate answer for externally linked image URLs.
Step 6: Carry the SEO metadata over — deliberately
Your WordPress titles and descriptions mostly do not live in the post content. They live in your SEO plugin’s fields, and the standard WXR export does not carry them. A migration that skips this step ships a new site with worse metadata than the old one — the exact regression the honest Astro SEO checklist exists to catch.
Pull the plugin’s title and description fields separately — through the plugin’s own export, a bulk-export tool, or a script against the database or REST API — into a simple table keyed by slug. Then merge that table into your Markdown frontmatter, slug by slug. While you are there, carry over anything else the plugin owned that you still want: canonical choices, noindex flags on thin pages, and social images.
You should now have: every migrated page carrying the same title and description it had on WordPress, verified by spot-checking your top pages against the old site.
Step 7: Build the URL map and the redirects
Astro’s file-based routing means you can usually keep URLs identical: a post at /my-post/ stays at /my-post/, because the slug from Step 3 names the route. Protect that default. Every URL that does change — a new /blog/ prefix, renamed categories, consolidated posts — needs a redirect from old to new.
Build this table before the rebuild finishes, one row per URL that changes:
| Old URL | New URL | Action | Notes |
|---|---|---|---|
/2023/05/my-post/ |
/blog/my-post/ |
301 redirect | Date-based permalink structure removed |
/category/news/ |
/topics/news/ |
301 redirect | Category base renamed |
/old-promo-page/ |
/ |
301 redirect | Campaign ended; send to home, not a 404 |
/spammy-guest-post/ |
— | 410 / no redirect | Deliberately retired content |
/about-us/ |
/about/ |
301 redirect | Kept short URL as canonical |
Rules of thumb: 301 for anything with a genuine successor page; redirect to the closest relevant page rather than dumping everything on the homepage; retire truly worthless pages without a redirect instead of pointing them somewhere irrelevant. And keep URLs that do not change exactly unchanged — trailing slashes included — because “nearly the same” is a different URL.
On Cloudflare, a _redirects file shipped with the static output handles the list, and bulk redirects cover very large maps; the mechanics are part of deploying and running Astro on Cloudflare.
You should now have: a completed map in which every URL from the Step 1 list is accounted for — unchanged, redirected, or deliberately retired.
Step 8: Replace what the plugins did
Static Astro has no WordPress runtime, so each plugin from the inventory needs its replacement in place before launch:
- Comments. Native WordPress comments do not migrate into a static site. The realistic options are a hosted commenting embed, a GitHub-based comment system, importing the old discussion into whichever service supports it, or closing comments. Decide from how much genuine discussion your comments contain — usually less than feared.
- Forms. Contact and lead forms need a provider or an endpoint on a static site; the static-site forms patterns cover the realistic options and their costs.
- Search. WordPress’s built-in search disappears. A static search index (Pagefind is the common choice) replaces it well for content sites and runs entirely in the reader’s browser.
- Anything dynamic per visitor — memberships, logged-in dashboards, live inventory — does not belong in a purely static build. A hybrid Astro deployment can cover a few such routes, but a site whose core is dynamic should question the migration itself, before Step 1 rather than at Step 8.
You should now have: every plugin from the inventory either rebuilt, replaced by a service, or retired in writing.
Step 9: Rebuild the design — do not replicate it
Resist pixel-matching the WordPress theme. Choose or build an Astro theme that is structurally right — the evaluation approach in choosing an Astro theme applies — and accept visual differences that do not affect readers.
Migration is also the one cheap moment to fix the old site’s accumulated debt: the mobile layout nobody liked, the hero image that cost a second of load time, the archive page structure that never matched how readers browse. Fix what readers feel. Leave the rest alone; a migration that also becomes a redesign is how timelines double.
You should now have: a staging site that looks like the new design, reads like the old site, and passes a human read-through of the top 20 pages by traffic.
Step 10: Launch, then watch the URLs
Launch is a sequence, not a moment:
- Final delta export if the site kept publishing after the first one (Step 2), converted and merged the same way.
- Deploy the new site with the redirects live at the same time. Redirects that arrive a week after launch protect nothing.
- Keep the old WordPress site reachable privately — a subdomain or hosts-file entry — for at least a month. It is your reference for every “did this page exist?” question.
- Watch Search Console coverage for two weeks. New 404s are redirect-map gaps; fix them as they appear. Spot-check your top old URLs by hand, including a few image URLs from Step 5.
You should now have: the new site live, every old URL resolving to its planned destination, and a two-week watch that turns surprises into small fixes.
Troubleshooting: the failures that actually happen
Posts are dated one day late (or early) after conversion. The converter ran in UTC while WordPress published in your local timezone. Re-run it with your site’s timezone set (Step 3), before you build anything on top of the wrong dates — date-based permalinks inherit the error.
Shortcode text like [gallery] appears in converted posts.
Shortcodes are WordPress runtime instructions; no converter can execute them. Search the converted files for brackets, and replace each shortcode with its static equivalent — the gallery becomes the images, the embed becomes a link or an iframe.
The build fails on a handful of posts. Almost always frontmatter: a date in an unexpected format, a missing title, a category field shaped differently from the schema. The build error names the file. Fix the file, not the schema — loosening the schema to pass bad data re-creates the WordPress problem in a new stack.
Images 404 on the staging site.
Two usual causes: references still pointing at absolute WordPress URLs (rewrite them to the local files), or externally addressed images that were never copied into public/ (Step 5). Check which kind before fixing.
A redirect loops or lands on the homepage. Loops come from redirecting a URL to itself under a different slash or casing — compare the map’s rows character by character. Homepage landings come from a catch-all rule placed above the specific ones; order matters, specific first.
The migration checklist
- Inventory complete: content counts, full URL list, plugin/feature list, media volume
- Backup taken and freeze date set: content changes on WordPress stop, or a final delta export is planned
- Export converted: posts and pages as Markdown with frontmatter matching the target schema; build validates every file
- Media migrated: used images in
src/assets/with references rewritten; externally linked images kept at their old addresses; unused uploads consciously abandoned - SEO data carried over: plugin titles, descriptions, and canonical intent moved into frontmatter and spot-checked
- Redirect map complete: every changed URL has a row; unchanged URLs verified identical, slashes included
- Features dispositioned: comments, forms, search each rebuilt, replaced, or retired — in writing
- Staging review: the new site read on staging by a human, top 20 pages by traffic checked individually
- Launch mechanics: DNS/hosting switch planned, redirects live with the new site, old site kept reachable privately for a month
- Post-launch checks: Search Console coverage watched for two weeks; top old URLs spot-checked for correct redirects
How we researched this
This guide is desk research, not a migration we performed for this article. The sequence follows Astro’s official migration guidance and the documented behaviour of the tools it names — the WordPress WXR export and wordpress-export-to-markdown, whose current release line and options were checked in November 2026 — cross-read against the failure reports that recur in migration write-ups: timezone-shifted dates, stranded plugin metadata, and redirect gaps. Where a step depends on your host or your plugin set, the guide says so rather than inventing a universal answer.
FAQ
Will I lose my Google rankings migrating to Astro? Rankings are at risk mainly through changed URLs without redirects and lost metadata — both preventable with the map and checklist above. Keep URLs identical or redirected, carry the metadata over, and the technical side of the migration is sound. No honest guide can guarantee rankings stay identical; anyone who promises that is guessing.
How long does a WordPress to Astro migration take? A small blog: days. A large, plugin-heavy site: weeks, mostly spent on content cleanup and the redirect map rather than code. The inventory step exists to tell you which one you have before you commit to a timeline.
Can I keep my WordPress comments? Not natively in a static build. You can embed a hosted commenting service, import discussion into it where it supports that, or close comments. Decide from how much genuine conversation the old comments contain.
Should I change my URLs to a cleaner structure during the migration? Only with a complete redirect map, and only where the improvement is real. Every changed URL is risk and work; spend changes on structures that are actually hurting you, and leave working URLs alone.
Do I have to give up WordPress as an editor? No — a headless setup keeps WordPress as the editing backend while Astro fetches from its REST API at build time. It keeps the dashboard your editors know, at the cost of still running and securing a WordPress install. This guide follows the full-export route because it removes that cost entirely, but for multi-editor sites the headless route is a legitimate answer.
What to do next
Do the inventory this week — it costs an hour and converts a vague intention into a sized project. Then build the redirect map while the old site is still live to check against. If the new site needs a starting theme, browse the theme directory with your feature list in hand, and plan the hosting with hosting a static site for free if budget is the constraint.
Not every WordPress site should become Astro, though — if the goal is simply to keep publishing without the maintenance, the free Ghost hosting routes may be the shorter path.
Category: Astro Themes & Starters · Tags: #astro #tutorial #checklist #content #wordpress
Next step: this article is part of Astro guides, which covers the full topic from first setup to advanced use.