Eunus Hosen

The Complete Guide to Migrating from WordPress to EmDash CMS

In my previous post, I talked about why I finally moved ehosen.com off WordPress after 13 years and onto EmDash — Cloudflare's open-source, Astro-based CMS running on Workers, D1, and R2.

Since publishing that, a few people asked how the actual migration went and what it takes to move a live WordPress site over without breaking URLs, losing SEO rankings, or manually re-uploading hundreds of images.

This is the complete, step-by-step guide I wish I had when I started. Whether you are running a standard WordPress blog on a VPS or a headless WordPress setup with a separate frontend, this walkthrough covers everything from the pre-migration audit to zero-downtime DNS cutover.

Before You Touch Anything: The Pre-Migration Audit

Most painful migrations happen because people jump straight into exporting XML files before understanding what their WordPress site is actually doing. Spend 20 minutes doing this audit first — it will save you hours of debugging later.

1. Take a Full Backup of WordPress

Before installing any migration plugin or changing settings, make sure you have a complete backup of:

  • Your MySQL/MariaDB database (a full .sql dump).
  • Your wp-content/uploads directory (every image, PDF, and media file on disk).

Keep both stored safely locally or in an S3/R2 bucket until at least 30 days after your migration is live.

2. Document Your Exact Permalink Structure

Open Settings → Permalinks in wp-admin and write down the exact URL pattern your site uses. Common ones include:

  • /%postname%/
  • /articles/%postname%/
  • /%year%/%monthnum%/%postname%/
  • /blog/%postname%/

Also note whether your WordPress URLs end with a trailing slash (most WordPress sites do) and what your category/tag archive prefixes look like (typically /category/{slug}/ and /tag/{slug}/). Preserving these URLs — or setting up clean 301 redirects for any changes — is the single most important part of protecting your search traffic.

WordPress Admin Settings Permalinks showing the active custom permalink structure

3. Save Your Current Sitemap Locally

Fetch your current sitemap XML right now while WordPress is still live. Depending on whether you use core WordPress sitemaps, Yoast SEO, or Rank Math, it will usually be at /sitemap_index.xml or /wp-sitemap.xml.

curl -s https://yourdomain.com/sitemap_index.xml -o old-sitemap.xml

We will use this file at the end of the migration to run an automated check ensuring every single old URL returns HTTP 200 (or a clean 301) on your new EmDash site before you switch DNS.

4. Audit Your Active WordPress Plugins

Open Plugins → Installed Plugins in WordPress and sort every active plugin into one of four buckets:

Bucket

Examples

What to Do

Replaced by EmDash / Cloudflare

Yoast SEO, Rank Math, WP Rocket, W3 Total Cache, Wordfence, UpdraftPlus, Smush, Redirection

Drop them. EmDash includes built-in SEO fields, sitemaps, redirects, and an image pipeline; Cloudflare handles edge caching, WAF, and D1 Time Travel backups.

Replaced by an EmDash Plugin

Broken link checkers, cross-posting tools, form/lead delivery integrations

Check the EmDash plugin registry for a sandboxed equivalent.

Rebuilt in Astro

Related posts, table of contents, syntax highlighting, custom image galleries, callout boxes

Build these directly as lightweight Astro components. Most take 20–40 lines of code.

Dropped

Old social share bars, unused builders, plugins you installed five years ago and forgot

Leave them behind.

Note on e-commerce: If your site is a heavy WooCommerce store with complex checkout flows, subscriptions, and payment gateways, hold off for now — EmDash's commerce ecosystem is still very early. For blogs, developer sites, documentation hubs, marketing sites, and content-driven publications, EmDash is ready today.

5. Record Your Baseline Numbers & Check for Shortcodes

Write down the exact published and draft counts from your WordPress admin for:

  • Posts
  • Pages
  • Any Custom Post Types (CPTs)
  • Media Library items
  • Categories and Tags

You will compare these numbers against EmDash after the import to verify nothing was silently skipped. Also check if your posts rely heavily on WordPress shortcodes (like [gallery], [caption], or custom plugin shortcodes like [contact-form-7]) — shortcodes do not execute in EmDash, so you will want to know how many need cleanup.

6. Prerequisites on Your Machine

Make sure you have:

  • Node.js 20+ and pnpm (or npm) installed locally.
  • A Cloudflare account with your domain either already on Cloudflare DNS or ready to move there.
  • Wrangler CLI authenticated (npx wrangler login).

Step 1: Scaffold and Configure Your EmDash Project

Unlike WordPress, where the CMS and theme live on a remote PHP server and you edit things over SFTP or through a web dashboard, EmDash is a full-stack TypeScript application built directly on top of Astro. Everything — your frontend routes, layouts, bindings, and CMS configuration — lives in a Git repository.

Create the Project

Run the official scaffolder from your terminal:

pnpm create emdash@latest my-emdash-site

(If you prefer npm, run npm create emdash@latest -- my-emdash-site.)

When prompted, choose:

  • Where will you deploy? Cloudflare Workers
  • Which template? Blog (or Starter, Marketing, or Portfolio depending on your site)
  • Install dependencies? Yes
  • Enable sandboxed plugins? No for now (you can easily enable this later in wrangler.jsonc and astro.config.mjs)

Move into the new directory:

cd my-emdash-site
Terminal output of pnpm create emdash@latest completing with Cloudflare Workers and Blog template selected

The scaffolder automatically generates a .env file containing an EMDASH_ENCRYPTION_KEY. Do not commit .env to Git — you will upload that key as a Wrangler secret before going live.

Inspect wrangler.jsonc

Open wrangler.jsonc in your editor. The Cloudflare template wires up the bindings EmDash needs out of the box:

{
  "$schema": "./node_modules/wrangler/config-schema.json",
  "name": "my-emdash-site",
  "compatibility_date": "2026-11-01",
  "compatibility_flags": ["nodejs_compat"],
  "d1_databases": [
    {
      "binding": "DB",
      "database_name": "my-emdash-site-db"
    }
  ],
  "r2_buckets": [
    {
      "binding": "MEDIA",
      "bucket_name": "my-emdash-site-media"
    }
  ],
  "durable_objects": {
    "bindings": [
      {
        "name": "EMDASH_ROOMS",
        "class_name": "EmDashRoom"
      }
    ]
  },
  "triggers": {
    "crons": ["* * * * *"]
  }
}

A few important details here:

  • DB and MEDIA: On your first deploy, Wrangler automatically provisions the D1 database and R2 bucket if they do not exist yet. Keep these names stable so future deploys reconnect to the same resources.
  • EMDASH_ROOMS: Powers EmDash's real-time co-editing rooms via Durable Objects.
  • triggers.crons: Required if you want scheduled publishing, automated backups, and background maintenance tasks to run on Cloudflare Workers.
  • Targeted Placement (Recommended): Because server-rendered EmDash pages make multiple D1 queries per request, adding Targeted Placement in wrangler.jsonc runs your Worker near the D1 primary database instead of making cross-region round trips.

If you want to enable sandboxed plugins later, uncomment the worker_loaders binding (LOADER) in wrangler.jsonc and pass sandboxRunner: sandbox() in astro.config.mjs.

Crucial Step: Configure siteUrl and allowedOrigins Before Setup

Do not skip this. EmDash uses passkeys (WebAuthn) as its primary authentication method, and passkeys are strictly bound to the hostname (Relying Party ID) where they are created.

If you complete the initial EmDash setup on my-emdash-site.yourname.workers.dev and later switch to yourdomain.com, your passkeys will stop working on the custom domain unless you configure siteUrl properly upfront.

The cleanest pattern when migrating a live domain is to attach a temporary subdomain of your real domain (for example, https://new.yourdomain.com) to your Worker while https://yourdomain.com still serves WordPress. Then, in astro.config.mjs, set:

import { defineConfig } from "astro/config";
import cloudflare from "@astrojs/cloudflare";
import emdash from "emdash/astro";
import { d1, r2 } from "@emdash-cms/cloudflare";

export default defineConfig({
  output: "server",
  adapter: cloudflare(),
  integrations: [
    emdash({
      siteUrl: "https://yourdomain.com",
      allowedOrigins: ["https://new.yourdomain.com"],
      database: d1({ binding: "DB", session: "auto", coalesce: true }),
      storage: r2({ binding: "MEDIA" }),
    }),
  ],
});

Because new.yourdomain.com is a subdomain of yourdomain.com, WebAuthn registers your passkey against the root Relying Party ID (yourdomain.com). Your passkey works immediately on new.yourdomain.com during the migration, and it keeps working seamlessly the second you switch DNS to yourdomain.com.

Note: Until DNS points yourdomain.com to EmDash, any magic-link or password-reset emails will link to yourdomain.com (still WordPress). Make sure every admin registers a passkey on the temporary subdomain before cutover.

Upload Your Encryption Key Secret

Copy the EMDASH_ENCRYPTION_KEY from your local .env file and store it as a Cloudflare Worker secret so encrypted plugin settings work in production:

pnpm wrangler secret put EMDASH_ENCRYPTION_KEY

Keep a copy of this key in your password manager — it is stored separately from your D1 database backups.

Step 2: First Deploy, Setup Wizard, and Staging Mode

Now let's build and deploy the empty EmDash shell to Cloudflare so we have a live admin panel ready to receive your WordPress content.

pnpm run build
pnpm run deploy

On the first deploy, Wrangler creates your D1 database, R2 bucket, and Durable Object bindings automatically. Once the deploy finishes, attach your temporary subdomain (e.g., new.yourdomain.com) to the Worker in Cloudflare Dashboard → Workers & Pages → your Worker → Settings → Domains & Routes.

Complete the Setup Wizard

Open https://new.yourdomain.com/_emdash/admin/ in your browser. On the very first request, EmDash automatically runs its core D1 database migrations and greets you with the setup wizard.

  1. Enter your site title and administrator email.
  2. Register your Passkey (Touch ID, Face ID, YubiKey, or password manager passkey).
  3. Complete the setup and land in the EmDash dashboard.
EmDash Admin Setup Wizard at /_emdash/admin/ showing Passkey registration

Turn On Staging Mode Immediately

Before importing a single post, go to Settings → General in EmDash and enable Staging Mode.

Staging Mode adds noindex headers and updates robots.txt so search engines do not crawl or index your temporary subdomain (new.yourdomain.com) as duplicate content while you are migrating.

Run emdash doctor

Back in your terminal, run:

pnpm emdash doctor

This checks your project wiring — including your Cloudflare Cron Trigger and scheduled handler — and flags any misconfigurations early.

Step 3: Choose Your WordPress Import Method

EmDash supports two ways to import WordPress content:

Feature

EmDash Exporter Plugin (v1.2.0+)

WXR XML Export (Tools → Export)

Posts, Pages, Custom Post Types

Yes

Yes

Categories, Tags, Custom Taxonomies

Yes

Yes

Authors & Guest Bylines

Yes

Yes

Media & Featured Images

Yes (pulled into R2 + URLs rewritten)

Yes (pulled from live WP URLs + rewritten)

Navigation Menus

Yes (requires Exporter 1.2.0+)

Yes (EmDash 1.5+)

Comments

Yes (requires Exporter 1.2.0+)

No

Site Title, Tagline, Logo & Favicon

Yes (requires Exporter 1.2.0+)

No

SEO Metadata (Yoast / Rank Math)

Yes

No

Works Without Installing Plugins

No

Yes

Password-Protected Posts

Imported with original status (no password)

Always imported as Draft

My recommendation: If you control your WordPress admin and can install plugins, always use the EmDash Exporter plugin (v1.2.0 or newer). Bringing over your SEO descriptions, site identity, menus, and comments automatically saves a massive amount of manual work. Use WXR only if you are migrating from a locked-down WordPress host where you cannot install plugins.

Option A (Recommended): Connect the EmDash Exporter Plugin

  1. Install and activate the EmDash Exporter plugin on your WordPress site.
  2. Open Plugins in wp-admin and verify the installed version is 1.2.0 or higher. (Earlier versions silently skip comments, menus, logo, and favicon.)
  3. Open Tools → EmDash Migration in WordPress.
  4. Click Generate Migration Key and copy the key to your clipboard.
WordPress Admin Tools EmDash Migration screen with the generated Migration Key

(Alternatively, you can enter your WordPress site URL directly in EmDash and authorize via WordPress Application Passwords — though the Migration Key flow in 1.2.0+ is faster and avoids HTTPS callback headaches if you are testing on localhost.)

Watch Out for Cloudflare WAF & Bot Fight Mode

If your old WordPress site is already sitting behind Cloudflare, Cloudflare's security rules will often block your new EmDash Worker from talking to WordPress (returning 403 Forbidden during import or media downloads).

Before starting the import, add a temporary WAF Skip Rule on your WordPress zone for these two paths:

  • /wp-json/emdash/v1/
  • /wp-content/uploads/

If your WordPress zone is on the Cloudflare Free plan, also temporarily disable Bot Fight Mode under Security → Bots until the import and media copy finish. Remember to turn it back on afterward if you keep WordPress around.

Option B: Export a WXR File

If you cannot install plugins on WordPress:

  1. In WordPress, go to Tools → Export.
  2. Select All content (not just Posts — you want Pages, Media attachment metadata, and Custom Post Types too).
  3. Click Download Export File to save the .xml file to your machine.
WordPress Admin Tools Export screen with All content selected

Remember: a WXR XML file only contains links to your images, not the actual image bytes. Keep your WordPress site publicly accessible online until the media download step in EmDash finishes.

Special Case: Migrating from a Local WordPress Site

EmDash executes its import and media downloads server-side and strictly rejects localhost, 127.0.0.1, and private IP addresses. Local hostnames like mysite.local or mysite.test will also fail because EmDash resolves domains through public DNS.

If your WordPress site is running locally (via LocalWP, Docker, or Herd), expose it temporarily with a quick Cloudflare Tunnel:

cloudflared tunnel --url http://localhost:8080

Use the generated https://*.trycloudflare.com URL as your WordPress source during the import, then press Ctrl+C to close the tunnel once your content and media are safely inside EmDash.

Step 4: Run the Content & Media Import in EmDash Admin

With your Migration Key (or WXR file) ready, head over to your EmDash admin panel.

1. Open the Importer

In the EmDash admin sidebar, click Import, or navigate directly to:

https://new.yourdomain.com/_emdash/admin/import/wordpress
EmDash Admin Import from WordPress landing screen showing the Migration Key input and WXR upload tab

2. Connect & Analyze

Paste your Migration Key (or upload your WXR .xml file) and click Analyze.

EmDash inspects your WordPress site without writing anything to D1 yet. It scans every post type, custom field, taxonomy, author, reusable block, and attachment URL, and builds a migration plan.

3. Review Collection & Field Mappings

On the Review screen, check every detected WordPress post type:

  • Standard post entries map to your posts collection.
  • Standard page entries map to your pages collection.
  • Custom Post Types can either map to an existing collection or let EmDash create a new collection automatically.

Check the status badge next to every post type. You want every row to read ready or new collection. If any row shows incompatible, it means an existing EmDash field has a conflicting data type (for example, a number field in EmDash vs. a string field in WordPress) — resolve that schema mismatch in Collections before proceeding.

EmDash Import Review screen showing WordPress post types mapped to EmDash collections with green ready badges

4. Map Authors & Guest Bylines

Next, map your WordPress authors:

  • Map active editors (like yourself) to your EmDash User account.
  • Leave old guest authors or former contributors unmapped and select Guest Byline. EmDash creates standalone byline records so their names still appear on historical articles without giving them a login to your CMS.

5. Toggle Optional Extras

Depending on your import method, toggle the extras you want to bring over:

  • Navigation Menus (available in both Exporter and WXR)
  • Site Title & Tagline (Exporter only)
  • Logo & Favicon (Exporter only)
  • SEO Metadata — imports Yoast/Rank Math meta titles and descriptions into EmDash's native SEO fields (Exporter only)

6. Start the Content Import

Click Start Import. EmDash first creates any missing collections and fields, then imports taxonomies, entries, comments, and menus in bounded batches so Cloudflare Workers never hit CPU or request timeouts.

When it finishes, compare the imported item counts per collection against the baseline numbers you wrote down during your audit.

7. Run the Media Migration Step

Once content is imported, EmDash prompts you to run the Media step. Do not skip this!

During this stage, EmDash:

  1. Downloads every attachment byte from your live WordPress site.
  2. Stores each file in your Cloudflare R2 bucket (MEDIA).
  3. Generates metadata (dimensions, MIME type, blurhash, dominant color).
  4. Automatically rewrites image URLs inside your Portable Text content from https://yourdomain.com/wp-content/uploads/... to /_emdash/api/media/file/<storageKey>.
EmDash Media Import progress screen showing downloaded assets in R2 and rewritten URLs

When the media step finishes, verify that the Failed list is empty. If a few older images failed (often due to broken links that were already 404 on WordPress, or transient timeouts), inspect each failed URL and retry if needed.

Handling Partial Imports or Interruptions

If your network drops or a large site hits a hiccup mid-import, you do not have to wipe D1 and start over. EmDash tracks imported entries and allows you to retry failed media or resume without creating duplicate records. If you are migrating a massive site (thousands of posts) and prefer a scriptable local workflow, EmDash also offers the emdash import wordpress CLI with a --resume flag that tracks progress in .wp-migration-progress.json.

Step 5: Understand How WordPress Data Converts

After the import finishes, open a few posts in the EmDash editor to see how your content translated. Knowing the exact conversion rules prevents surprises before launch.

Post Statuses

EmDash maps WordPress statuses as follows:

WordPress Status

EmDash Status

What to Review

publish

published

Live immediately on your new site.

draft

draft

Stays unpublished.

pending

draft

Review before publishing.

private

draft

EmDash does not recreate WordPress's private visibility rules — leave as draft or delete.

future

draft

Important: Scheduled posts arrive as drafts. Re-schedule them in EmDash manually.

trash

draft

Important: Trashed WordPress posts can arrive as drafts. Delete any you don't want!

Password-Protected Posts

EmDash does not have per-entry passwords. Pay close attention to the difference between the two import paths:

  • WXR import: Password-protected posts always import as drafts (and are listed on the Import Complete screen) so nothing private leaks accidentally.
  • EmDash Exporter import: The exporter does not transmit post passwords, so a published password-protected post arrives published. If you had any password-protected posts in WordPress, unpublish or delete them in EmDash before going live!

Publication Dates

EmDash preserves your original WordPress publication timestamps for both published entries and drafts. Even if you review an imported draft and publish it days later, it retains its original historical publishedAt date rather than overwriting it with today's timestamp.

Gutenberg Blocks & Reusable Blocks

  • Gutenberg blocks are converted cleanly into Portable Text (structured JSON) instead of WordPress's HTML-with-comment-tags format. Headings, lists, code blocks, images, and links translate cleanly.
  • Reusable blocks (wp_block) are imported as EmDash Sections rather than normal posts.
  • Edge cases to check manually: Complex page-builder blocks (Elementor, Divi, WPBakery), custom callout shortcodes, and nested quote blocks occasionally lose styling or wrap raw text. Spot-check your most popular posts and clean up any leftover [shortcode] strings.

Step 6: Match Permalinks, Adapt Astro Routes, and Set Up Redirects

Now that your content is safely in D1 and your images are in R2, let's make sure your Astro frontend serves everything at the exact right URLs.

1. Set urlPattern on Your Collections

In the EmDash admin, open Settings / Collections → Articles (posts) and set the URL Pattern to match your WordPress permalink structure.

For example, on ehosen.com, my posts live under /articles/{slug}, so urlPattern is set to:

/articles/{slug}

If your WordPress blog used date-based URLs, EmDash supports date placeholders as long as each placeholder gets its own path segment:

  • Valid: /{year}/{month}/{slug}
  • Invalid: /{year}{month}/{slug} or /{slug}-{id}

2. Wire Up Your Astro Post Route

Your Astro file structure under src/pages/ must match your urlPattern. For /articles/{slug}, create src/pages/articles/[slug].astro:

---
import { decodeSlug, getEmDashEntry } from "emdash";
import { PortableText } from "emdash/ui";
import BaseLayout from "../../layouts/BaseLayout.astro";

const slug = decodeSlug(Astro.params.slug);
if (!slug) {
  return Astro.rewrite("/404");
}

const { entry: post, error } = await getEmDashEntry("posts", slug);
if (error) {
  return new Response("Could not load article", { status: 500 });
}
if (!post) {
  return Astro.rewrite("/404");
}
---

<BaseLayout
  title={post.data.title}
  description={post.seo?.description ?? post.data.excerpt}
>
  <article class="prose mx-auto py-12">
    <h1>{post.data.title}</h1>
    <PortableText value={post.data.content} />
  </article>
</BaseLayout>

A quick gotcha when working with EmDash in Astro: entry.id is the route identifier (usually the slug), while entry.data.id is the internal database ULID used by relationship helpers.

3. Wire Up Archives, Taxonomies, and Menus

For your blog index or category archive pages, use getEmDashCollection() and getTerm():

---
import { getEmDashCollection, getTerm } from "emdash";

const categorySlug = Astro.params.slug ?? "";
const term = await getTerm("category", categorySlug, { includeCounts: false });

const { entries: posts } = term
  ? await getEmDashCollection("posts", { where: { category: term.slug } })
  : { entries: [] };
---

And for navigation menus imported from WordPress:

---
import { getMenu } from "emdash";

const primaryMenu = await getMenu("primary");
---

<nav>
  {primaryMenu?.items.map((item) => (
    <a href={item.url}>{item.label}</a>
  ))}
</nav>

4. Handle Trailing Slashes Without Breaking EmDash Admin

WordPress loves trailing slashes (/my-post/), whereas Astro defaults to no trailing slash (/my-post). If you add Astro middleware to normalize trailing slashes with 301 redirects, make sure you exclude /_emdash and /.well-known, or you will break the admin panel, API endpoints, and WebAuthn/SSL checks:

// src/middleware.ts
import { defineMiddleware } from "astro:middleware";

export const onRequest = defineMiddleware((context, next) => {
  const { pathname, search } = context.url;

  if (
    pathname !== "/" &&
    pathname.endsWith("/") &&
    !pathname.startsWith("/_emdash") &&
    !pathname.startsWith("/.well-known")
  ) {
    return context.redirect(`${pathname.slice(0, -1)}${search}`, 301);
  }

  return next();
});

5. Add Legacy WordPress Redirects

Even if your post slugs match 1:1, WordPress exposes a handful of legacy routes that external sites and RSS readers still hit. Add 301 redirects (either in EmDash's built-in redirects or in your Astro routes/Cloudflare Bulk Redirects) for:

  • /feed/ → /rss.xml (or wherever your Astro RSS endpoint lives)
  • /category/* → your new category path (if you changed it)
  • /tag/* → your new tag path (if you changed it)
  • Any individual posts whose slugs you decided to clean up during the migration

Deploy your updated Astro routes to Cloudflare:

pnpm run build && pnpm run deploy

Step 7: Pre-Cutover Verification (Do Not Skip This)

Never point DNS at a migrated site based on "looks fine on the homepage." Run through these four checks on https://new.yourdomain.com first.

1. Verify Every Single Sitemap URL Automatically

Remember old-sitemap.xml that we saved before we started? Run a quick Node script to test every single URL from your old WordPress site against your new EmDash deployment:

// verify-urls.mjs
import fs from "node:fs";

const OLD_ORIGIN = "https://yourdomain.com";
const NEW_ORIGIN = "https://new.yourdomain.com";

const xml = fs.readFileSync("old-sitemap.xml", "utf8");
const urls = [...xml.matchAll(/<loc>(.*?)<\/loc>/g)].map((m) => m[1]);

let failures = 0;

for (const oldUrl of urls) {
  // If old-sitemap.xml is a sitemap index, fetch child sitemaps first
  if (oldUrl.endsWith(".xml")) {
    const childXml = await fetch(oldUrl).then((r) => r.text());
    const childUrls = [...childXml.matchAll(/<loc>(.*?)<\/loc>/g)].map((m) => m[1]);
    urls.push(...childUrls);
    continue;
  }

  const testUrl = oldUrl.replace(OLD_ORIGIN, NEW_ORIGIN);
  const res = await fetch(testUrl, { redirect: "manual" });

  if (res.status !== 200 && res.status !== 301) {
    console.error(`FAIL [${res.status}] ${testUrl}`);
    failures++;
  }
}

console.log(`Done. Total failures: ${failures}`);

Run it:

node verify-urls.mjs

Do not move to DNS cutover until Total failures: 0 (or every non-200 is an intentional deletion you've accounted for).

2. Spot-Check 10 Random Posts in the Browser

Open at least 10 posts across different years — especially your oldest posts and your most complex ones. Check:

  • Images: Open DevTools → Network and confirm images load from /_emdash/api/media/file/... on your new site — not hotlinked from your old WordPress server!
  • Code blocks & formatting: Verify syntax highlighting, headings, lists, and blockquotes rendered properly.
  • Quotes & embeds: Check YouTube embeds, tweets, and quote blocks (some WordPress quote formats can lose body text or keep only the citation).
  • No leftover shortcodes: Search your EmDash content for [ or your old staging domain to catch stray shortcodes or hardcoded internal links.

3. Review Your Drafts List

Open your Drafts tab in EmDash and clean house:

  • Delete any imported WordPress trash items.
  • Re-schedule any future posts that arrived as drafts.
  • Confirm any private or password-protected posts are still drafts (or removed).

4. Configure Email & Confirm D1 Backups

Cloudflare Workers does not include a built-in mail server out of the box. If you want magic-link sign-in, admin invites, or notifications to work in production, configure either:

  • Cloudflare Email Sending (via a send_email binding), or
  • SMTP under Settings → Email (works with Amazon SES, Brevo, Fastmail, or Postmark using port 587 STARTTLS or 465 TLS — note that Cloudflare blocks outbound port 25).

Also verify D1 Time Travel is active on your Cloudflare D1 database and note a recovery bookmark before launch.

Step 8: Zero-Downtime DNS Cutover & Post-Migration Cleanup

You are ready to go live. Because we already configured siteUrl and allowedOrigins back in Step 1, cutover is clean and takes less than five minutes.

1. Add Your Production Domain to Cloudflare Workers

In the Cloudflare Dashboard:

  1. Open Workers & Pages → your EmDash Worker → Settings → Domains & Routes.
  2. Click Add → Custom Domain and enter yourdomain.com (and www.yourdomain.com if you use it).
  3. Cloudflare automatically updates your DNS records and provisions the SSL certificate to route traffic directly to your Worker.
Cloudflare Dashboard Workers & Pages Domains & Routes adding the production custom domain

2. Switch the Site URL in EmDash

Open https://yourdomain.com/_emdash/admin/ and sign in with your passkey.

  1. Go to Settings → General.
  2. Click Change domain next to Site URL.
  3. Enter https://yourdomain.com and click Check and switch. EmDash verifies ownership via a one-time domain-proof request to your live domain and updates the Site URL.
  4. Turn Staging Mode OFF so search engines can crawl and index your new site!
  5. Save your settings.
EmDash Admin Settings General showing Change domain verified and Staging Mode toggled OFF

3. Remove allowedOrigins & Re-Verify Production

Remove the temporary allowedOrigins entry from astro.config.mjs, remove the new.yourdomain.com custom domain from your Worker, and deploy once more:

pnpm run build && pnpm run deploy

Re-run verify-urls.mjs pointed directly at https://yourdomain.com to confirm everything returns 200 / 301 on the real domain.

4. Post-Launch Monitoring (Next 2–4 Weeks)

  • Submit your new sitemap (/sitemap.xml) in Google Search Console.
  • Watch Search Console for two weeks for any unexpected 404 spikes or crawl errors and add redirects immediately if anything pops up.
  • Keep your old WordPress server alive (but offline/unindexed) for 30 days. Put it behind HTTP Basic Auth or a private hostname so you can always reference an old post or grab a missing asset if you notice something a week later. Once a full month passes with clean Search Console reports, cancel that VPS and enjoy paying $0/month for idle server overhead.

Troubleshooting Common Migration Issues

If you hit a snag during the import, here are the five issues people run into most often:

  • "The XML file cannot be parsed" (WXR path): WordPress plugins occasionally inject stray whitespace, PHP notices, or invalid control characters into WXR exports. Open the .xml file in VS Code, check the very first line (it must start with <?xml version="1.0"), and strip any leading blank lines or invalid characters.
  • "Collection is marked incompatible": An existing field in your EmDash collection has a different data type than the incoming WordPress field (e.g., integer vs. string). Either adjust the EmDash field type before importing or map the WordPress post type to a fresh collection.
  • 403 Forbidden / Bot Protection Blocks the Exporter: Your WordPress site's WAF (Cloudflare, Wordfence, or Sucuri) is blocking requests from Cloudflare Workers to /wp-json/emdash/v1/. Add a WAF skip rule for /wp-json/emdash/v1/ and /wp-content/uploads/, and temporarily pause Bot Fight Mode on Cloudflare Free plans.
  • Media URLs Fail to Download: Make sure your WordPress site is publicly reachable over HTTPS and not blocking hotlinking or non-browser User-Agents. Also remember that local .local or localhost URLs cannot be fetched by EmDash without a public tunnel.
  • Scheduled Posts Aren't Publishing on Cloudflare: Run pnpm emdash doctor to confirm both the Cron Trigger in wrangler.jsonc and the scheduled handler in your Worker entry point are wired up. Note that Cloudflare can take up to 15 minutes to start firing a newly added Cron Trigger — you can watch it execute in real time with pnpm wrangler tail.

Wrapping Up

Migrating a mature WordPress site always feels more intimidating before you start than it actually is once you have a checklist. EmDash's built-in importer handles the tedious 90% — schemas, Portable Text conversion, taxonomies, SEO fields, and copying media into R2 — so your real job is just auditing your plugins, matching your permalinks, and verifying your URLs before flipping DNS.

Once the switch is done, you go from babysitting PHP versions, MySQL updates, and monthly VPS bills to pushing Astro commits to Git and letting Cloudflare Workers handle the rest at the edge. If you run into any edge cases during your own migration, feel free to reach out — happy to help debug.