Move WordPress posts into MDX files

Pauline used Claude Code to pull a WordPress archive into MDX and sort it into year folders.

Done with Claude Code· Intermediate

What they did
Pauline asked Claude Code, working as a terminal-based agent, to take every post from her WordPress REST API, turn the content into MDX with frontmatter, and place the files into folders organized by year. It dealt with API limits, transformed HTML into Markdown, and retried after an encoding problem interrupted the script. Pauline supervised the process and checked the results while focusing on other work.
How it went
The transfer finished in roughly 4 hours and covered 367 posts plus 5 pages. Older entries with malformed image tags caused the build to fail, and Claude repaired those issues in bulk using a regex-based pass over the directory.
Tips
Legacy WordPress content often includes broken markup, so expect a few build failures during conversion. It helps to let the agent read the errors and apply fixes across the whole set instead of handling each file one by one.

Try it yourself with Claude Code

Collect all posts and pages from [WordPress site URL] using the REST API, convert each entry into an MDX file with frontmatter for [title/date/slug/tags/other fields], and save the files in [folder path] grouped by year. If you run into rate limits, encoding issues, or build errors from old HTML, stop and tell me what failed. Before any irreversible action like overwriting, deleting, sending, or submitting, show me the proposed change and wait for my approval. Finish by reporting how many posts and pages you converted and which items still need manual cleanup.

Fill in the [brackets]. Agents can make mistakes, so review anything before it is sent, paid or deleted.

1 more report of this

Get 3 agent uses like this every morning

With the day's top AI news. Free, and one click to unsubscribe.