← All use cases

中文

Building software · Claude Code

Move every WordPress post into MDX files for a static site

Idea + starter prompt, not run by us yet

For: Bloggers leaving WordPress who have hundreds of old posts to move

Pauline gave Claude Code one goal: pull every post from her WordPress REST API, turn it into MDX with frontmatter, and save it in folders by year. It dealt with rate limits, converted HTML to Markdown and reran after an encoding error. 367 posts and 5 pages moved in about four hours. Broken image tags in old posts stalled the build until Claude fixed them in bulk.

Steps

  1. Back up your WordPress site and check that its REST API is reachable.
  2. Decide the frontmatter fields and folder layout you want before you start.
  3. Ask Claude Code to test the export on five posts first and show you the output.
  4. Run the full export, then build the site and have Claude Code fix what the error output shows.
  5. Check old posts for broken image tags and spot check a sample of posts against the live site.

Starter prompt

Starter prompt. Change the [brackets] first.

I want to move my WordPress blog at [site URL] into MDX files for [static site framework]. Use the public REST API only, read-only. Save each post as MDX with frontmatter fields [title, date, tags, slug] in folders named by year under [output folder]. Respect rate limits. First run the script on 5 posts and show me the files so I can check formatting. Do not change anything on the WordPress site. After the full run, build the site, read any build errors, and propose bulk fixes before applying them. Do not ask me for my WordPress password.

Original post: pawlean.com · found via agentusecases.ai. Written up in our own words. We haven't run it, so test it on made-up data first.