Skip to content
agentusehub

Migrate WordPress posts to MDX

Claude Code pulled posts from the WordPress REST API and converted them to MDX with frontmatter, migrating 367 posts and 5 pages in one session.

Time saved
Not reported
Setup time
Not reported
Running cost
Not reported
Cost range
Not reported

Use case overview

Claude Code pulled posts from the WordPress REST API and converted them to MDX with frontmatter, migrating 367 posts and 5 pages in one session.

Reported experience

  1. What they did

    Pauline gave Claude Code, running as a terminal agent, one goal. It was to extract all posts from her WordPress REST API, convert them to MDX with frontmatter, and save them into year-based folders. It handled API rate-limiting, turned the HTML into Markdown, and re-ran its script after an encoding error. She says she directed and reviewed while doing other things.

  2. How it went

    All 367 posts and 5 pages moved to local MDX in one afternoon, which she puts at about 4 hours. Old posts with broken image tags stalled the build, and Claude fixed them with a regex across the directory.

  3. Worth knowing

    Expect build failures from messy legacy HTML, such as broken image tags. Let the agent read the build errors and fix them in bulk.

Example prompts

Try with Claude Code
Pull all posts and pages from my WordPress site at [site URL] using the REST API and convert each one to an MDX file with frontmatter (title, date, slug, tags, [other fields]). Save them in [folder path] in my project. Finish by giving me a count of posts and pages converted and a list of any that had formatting problems you couldn't fix cleanly.
Software & DevOps

Port a Chrome extension to Safari

The author had ChatGPT take the Session Buddy extension source from Chrome, port it to Safari and install it, taking about 20 minutes.

ChatGPT