Skip to main content

Moving content from WordPress to Markdown

How to get your content out of WordPress as Markdown: the export, the conversion, your images and URLs, and what tends to bite along the way.

A 5 minute read by Damien Guard, Engineering & Ops

In Do you still need WordPress? I waved at migration with the line "export that content and convert it to Markdown". That's very much the "draw the rest of the owl" step, so here's some more practical advice.

Back in 2018 I wrote my own HTML converter to pull the posts out of WordPress, then fed the result through HTML-to-Markdown converters and fixed whatever came out wrong by hand.

Thankfully things have changed a lot since then.

First, get everything out of WordPress: Tools > Export, then All Content. You'll end up with a WXR file, which is really just an .xml file, and it contains all your content including drafts, revisions and a whole lot more. (If you really just want posts or pages there are some other options too.)

Convert to Markdown

Next up is wordpress-export-to-markdown, which reads your export file and writes one Markdown file per post, with front matter, and downloads your images, rewriting the references to them. It's a command-line tool rather than a WordPress plugin, so it runs on your own machine and needs Node.js:

npx wordpress-export-to-markdown

This starts a wizard which asks where your export file is, what folder structure you'd like, which images to save and which front matter fields to include. Running it again skips files that already exist, so you can stop and pick up where you left off, and to start from scratch you just delete the output folder.

Hold on to each post's original slug, the last part of its old address. You'll want it if you need to redirect the old URLs later. The default does this for you by naming each file or folder after the slug, and if your old permalinks included the date there's a date-folder option that reproduces that layout. Your export file also records every post's full original address, so keep it somewhere safe.

You'll run it more than once, so don't be precious about the first go: convert a copy, look at the output, change your answers and run it again.

There are other options, but this looks like a good one based on its 1,600 stars on GitHub and an active maintainer (version 3.0.6 came out in July 2026).

What to keep

Now it's time to go through your site and Marie Kondo it. Decide what brings you joy, helps your customers and agents, and feeds Googlebot. A quick trip to your analytics will show you which pages actually matter, so make sure to spend your effort appropriately.

Some things to consider:

  • Blog posts. Are you talking about products and services you offer? Is the industry commentary still valid?
  • Case studies & portfolio. Are you still proud of the work or have you come a long way?
  • Staff & team pages. Do they list the people who work for you today? Are the roles and photos up-to-date?
  • Services & product pages. Do they describe the products and services you still offer? And how you approach them?

What gets converted

Your posts, pages and custom types all come along for the ride, one Markdown file each, drafts included. Each file holds the content plus the all-important front matter: a block at the top with things like the title, categories, author and date. The images get downloaded too, which we'll get to in a moment.

Before continuing, remove the drafts and revisions, along with any other pages you've decided not to keep. Drafts are converted like everything else and will be sitting in your output folder, and there's no point spending effort cleaning up content you're never going to publish. Do it once you're happy with the output, because running the converter again will bring back anything you've deleted.

A few things don't make the trip: anything added by WordPress plugins, like shortcodes and SEO things, and, curiously, comments! If you want comments on a static site without handing all the control to a service like Disqus, my WordPress to Jekyll part 2 - Comments & commenting post still has some useful guidance. (Spoiler: comments become .yml files and new ones arrive as pull requests from a small form handler.)

Images

The converter is also capable of downloading two categories of image:

  • Attached images are the ones you uploaded through the media library, including featured images, as long as they're GIF, JPEG, PNG or WebP.
  • Scraped images are any <img> in a post's content, whatever its type and wherever it's hosted, even if it lives on someone else's server.

You simply choose attached, scraped, all or none in the wizard. Each one lands in an images folder next to its post, and the Markdown is updated to point at it with a relative URL.

Clean up & check

This is the most time-consuming part, especially if you have a lot of content to preserve, though AI tools can help you get through it faster. I'd strongly recommend throwing a mid-tier model like Anthropic's Sonnet at the job; cheaper ones such as DeepSeek or GLM are more than capable here too. Resist having AI rewrite all your content, and don't waste tokens and energy on expensive models.

Comments & shortcodes

WordPress and its plugins leave code like <!-- wp:paragraph --> or [gallery] in your posts, and none of it means anything outside WordPress. There are a lot of possibilities, which makes this a great job for AI: have it scan through and suggest what to do. Some can simply be dropped, and others might be worth having AI create a Vue or React component you can use from Markdown.

Inline styles

Those styles won't mean much on the new site, and even where they do they'll probably clash with your redesign. This is your chance to swap them for semantic HTML: blog posts are well served by the usual headings, paragraphs, quotes, lists and tables.

Image check

While you're in there, think about the images your content links to:

  • Are they still relevant?
  • Is the image resolution and quality high enough?
  • Are they correctly licensed and attributed?

For the ones that pass, upload them to some hosting. I'm a big fan of Cloudflare R2 or Amazon S3, which offer fast, cheap and reliable hosting for exactly this kind of file. (Yes, you really can have all three.)

Where next

You should now have a folder of clean, ready-to-use Markdown to drop into Nuxt, Astro, Next.js or any other Markdown-powered static site generator and, if you went that route, a nice library of images up on R2 or S3.

Each of those site generators has its own templates, starters and abilities to explore, and all of them are more than capable of rendering your content.

Then all you'll need is a nice editing experience, and for that we've got you covered.

WordPressMarkdownMigrationStatic sites

About the author

Engineering & Ops

Damien has spent three decades building the tools other developers depend on — Entity Framework at Microsoft, the Atom editor at GitHub and SDKs at Auth0 — and runs engineering and operations at Intracia.

Read his full profile