Overview
Have Claude Code write and run a script that pulls posts from a WordPress site's REST API and turns each one into an MDX file with front matter, then review a sample before converting the rest.
Problem or Objective
- Which agents port code to another language or framework?
- Which tools turn office files and PDFs into Markdown for an agent?
More in Coding and Code Review
AI Agents and Models
Tools and Integrations
- Tools
- Claude Code · WordPress · MDX
- Prerequisites
- Claude Code, a WordPress site whose REST API is reachable, and a static site project that renders MDX.
How It Works
In the repository of your new site, start Claude Code and describe the target: one MDX file per post in a content folder, with front matter for title, date, slug, excerpt, categories and tags. Ask it to write a small script that pages through the posts endpoint of your WordPress site's REST API, converts each post's HTML body to MDX, rewrites internal links to the new paths and lists every shortcode or embed it could not convert. Have it run the script on five posts first and show you the files. Check them in your local build, adjust the rules, then let it run the full export. Finally, ask it to produce a redirect list from old to new URLs and a report of posts needing manual fixes, and commit the result on a branch for review.
Implementation Workflow
Steps assembled from the agents, tools and prompt of this entry. Adapt them to your own setup.
- Choose the agentSet up Claude Code.
- Connect the toolsConnect the tools this workflow relies on: Claude Code, WordPress, MDX.
- Check the prerequisitesClaude Code, a WordPress site whose REST API is reachable, and a static site project that renders MDX.
- Gather your detailsCollect what the prompt asks for: Script language, WordPress site address, Target folder, New URL pattern.
- Run the starter promptPaste the starter prompt below into Claude Code and adapt it to your case.
- Check against the documentationCompare what you get with the documentation at code.claude.com before you rely on it.
Practical Starter Prompt: Export WordPress posts to MDX files
Fill the fields to adapt the prompt. Empty fields stay as visible [placeholders].
Write a script in [Script language] that reads all published posts from the REST API of [WordPress site address] and writes one MDX file per post to [Target folder], with front matter for title, date, slug, excerpt, categories and tags. Convert the HTML body to MDX, rewrite internal links to the pattern [New URL pattern], and log every shortcode or embed you cannot convert. Run it on the first five posts only, show me the output and wait for my approval before doing the rest. Then produce a redirect list and commit on a new branch; do not push or deploy.Review the five sample files in your local build before approving the full run. You push the branch and switch redirects yourself after checking the report.
Expected Results and Benefits
This is a suggested workflow, not a reported result. The points below are what the cited documentation says the tools can do.
This is a suggested workflow, not a reported outcome. The Claude Code docs describe an agentic coding tool that reads your codebase, edits files and runs commands, and lists tedious tasks such as updating dependencies among its uses. They do not mention WordPress or MDX, so the conversion quality depends on the script you review. How your WordPress site exposes posts and media through its REST API was not verified here.
Limitations and Considerations
Check whether your WordPress site exposes the posts you need through its REST API without logging in; drafts and private posts may need credentials, which you should keep out of the repository. Images usually stay on the old host until you copy them, so plan media and redirects before switching domains. Check which commands your Claude Code permission settings let it run without asking before you start the full export. Results depend on your setup and were not independently reproduced by Top 200 Repos.
GitHub Repositories
AI Agent Repository
Source code of the agent that does the work.
Official Website
The official site of the main tool or project in this use case.
Visit Website (opens in a new tab)code.claude.com
Related Videos
About anthropics/claude-code
The SECRET Claude Code Upgrade That Has Everyone Going Nuts (Full Guide) (opens in a new tab)
The title names the project, the description links the project website.
Watch on YouTube (opens in a new tab)About anthropics/claude-code
The only Claude Code guide you'll ever need (Opus 4.5) (opens in a new tab)
The title names the project, the description links the project website.
Watch on YouTube (opens in a new tab)Independent creators. Listing a video implies no endorsement, sponsorship or partnership.
Sources
- Overview - Claude Code Docs (opens in a new tab)
Project documentation · code.claude.com · Undated · Source checked 25 Nov 2026, 11:57 UTC
What this source supports
- Claude Code is an agentic coding tool that reads your codebase, edits files, runs commands and integrates with your development tools.
- It handles tedious tasks such as writing tests for untested code, fixing lint errors across a project, resolving merge conflicts and updating dependencies.
- anthropics/claude-code README (opens in a new tab)
Project documentation · github.com · Undated · Source checked 25 Nov 2026, 11:59 UTC
What this source supports
- Claude Code lives in your terminal, understands your codebase and helps you code faster by executing routine tasks, explaining complex code and handling git workflows through natural language commands.

