wp-rest-api
Skill by WordPress
Guides building, extending and debugging WordPress REST API endpoints, routes, fields and permissions. Built for developers working on WordPress plugins, themes or mu-plugins.
Install wp-rest-api
Built from the published package, never by AI.
git clone --depth 1 https://github.com/WordPress/agent-skills /tmp/agent-skills && mkdir -p ~/.claude/skills && cp -r /tmp/agent-skills/skills/wp-rest-api ~/.claude/skills/wp-rest-apiRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/WordPress/agent-skills /tmp/agent-skills && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/agent-skills/skills/wp-rest-api ~/.gemini/antigravity-cli/skills/wp-rest-apiAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
This agent skill gives step-by-step guidance for WordPress REST API work. It covers registering routes with register_rest_route, using WP_REST_Controller classes, validating and sanitizing request arguments with a schema, and setting permission_callback and authentication. It also covers adding fields and meta to responses and exposing custom post types and taxonomies through show_in_rest.
Written from the project's SKILL.md and checked against it.
What it can do
- Custom routesRegisters custom endpoints on rest_api_init with register_rest_route and controller classes.
- Post type and taxonomy exposureMakes custom post types and taxonomies available under wp/v2 using show_in_rest and rest_base.
- Argument validationDefines args with types, callbacks and JSON Schema validation and sanitization.
- Permission checksRequires a permission_callback and capability checks rather than only logged-in checks.
- Response fields and metaAdds computed fields with register_rest_field and meta with register_meta.
- Authentication guidanceCovers cookie auth with X-WP-Nonce, application passwords and auth plugins.
- Client behaviorCovers discovery links, _fields, _embed, pagination and the per_page cap of 100.
- DebuggingExplains how to troubleshoot 401, 403, 404 and missing field errors.
What you need
- WordPress 7.0 or later (PHP 7.4.0 or later)
- Bash and Node.js
- WP-CLI for some workflows
Try asking
- Add a custom REST endpoint under my-plugin/v1 with a capability-checked permission_callback.
- Expose my book custom post type in the wp/v2 REST API with show_in_rest.
- Why is my REST route returning 403 for logged-in users?
Good to know
- Targets WordPress 7.0 and later, and calls out older target versions.
- Some workflows require WP-CLI.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: skills/wp-rest-api/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md5 KB -
references/authentication.md627 B -
references/custom-content-types.md760 B -
references/discovery-and-params.md730 B -
references/responses-and-fields.md1 KB
Show all 7 files
-
references/routes-and-endpoints.md1 KB -
references/schema.md964 B
Alternatives to wp-rest-api
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
wp-rest-api: common questions
Does this skill support WordPress versions below 7.0?
The skill targets WordPress 7.0 and later with PHP 7.4.0 or later. If the target version is below 7.0, the skill says to call that out.
How do I expose a custom post type through the REST API?
Set show_in_rest to true, add rest_base if needed, and optionally provide rest_controller_class. The routes then appear under wp/v2.
How does the skill handle REST authentication?
For wp-admin JavaScript it uses cookie auth with an X-WP-Nonce header using the wp_rest action. External clients can use application passwords or an auth plugin.
How do I install wp-rest-api?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is wp-rest-api free?
The code is published under the NOASSERTION licence. The service it connects to may have its own pricing.
Is wp-rest-api safe to use?
It scores 88 of 100. Grades: maintenance A, licence F, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to wp-rest-api?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
