# wp-rest-api

A skill for WordPress REST API work: register routes, validate arguments, wire permission checks, and track down 401 or 404 responses.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 5900 installs · ★ 2298
- Author: WordPress
- License: LicenseRef-Unknown · policy=link-only · description only; the file stays with the author
- Source: https://github.com/WordPress/agent-skills/tree/HEAD/skills/wp-rest-api/SKILL.md
- Updated: 2026-10-21
- HTML: https://affpapa.org/en/nevibecode/skills/wp-rest-api

## What it does

The skill gives the agent a fixed route through REST API work in WordPress. It starts by finding what already exists: `register_rest_route` calls, controller classes, the `rest_api_init` hook. Then it picks an approach, either `show_in_rest` on a post type or taxonomy, or a custom endpoint built on a controller class.

Reference files cover routes, schemas, responses and fields, authentication, discovery and request params. Two details it flags early: `per_page` tops out at 100, and unfiltered post HTML sits behind `?context=edit` with auth, best paired with `_fields=content.raw`. Debugging comes with it. A 404 usually means `rest_api_init` never fired, a typo in the route, or permalinks switched off.

It targets WordPress 7.0+ and PHP 7.4.0+. You need bash and node on the machine, and some workflows ask for WP-CLI. An older WordPress branch is a reason to check the version before installing.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add WordPress/agent-skills --skill wp-rest-api -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/wp-rest-api/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/wp-rest-api/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add WordPress/agent-skills --skill wp-rest-api -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/wp-rest-api/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add WordPress/agent-skills --skill wp-rest-api -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/wp-rest-api/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install WordPress/agent-skills wp-rest-api
```

2. **Manually: put the files in place**
- File: `.github/skills/wp-rest-api/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add WordPress/agent-skills --skill wp-rest-api -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/WordPress/agent-skills --path skills/wp-rest-api
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/wp-rest-api/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add WordPress/agent-skills --skill wp-rest-api -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/WordPress/agent-skills/tree/HEAD/skills/wp-rest-api/SKILL.md

## When to use it
- register a route with a real permission check
- debug a 401 on a cookie-authenticated endpoint
- add a computed field to the response
- expose a custom post type and taxonomy under `wp/v2`
- define an args schema instead of reading superglobals

## Example prompts
- Add a `my-plugin/v1/orders` route with `register_rest_route`, a `permission_callback` and an args schema
- Why does my endpoint return 401 when called from wp-admin?
- Expose the `portfolio` post type in REST and check it shows up under `wp/v2`

## Similar
- [agentmemory-rest-api](https://affpapa.org/en/nevibecode/skills/agentmemory-rest-api.md) — skill · 10800 installs
- [build-zoom-rest-api-app](https://affpapa.org/en/nevibecode/skills/anthropics-build-zoom-rest-api-app.md) — skill · 2100 installs
- [rest-api-design](https://affpapa.org/en/nevibecode/skills/rest-api-design.md) — skill · 2100 installs
- [rest-api-django](https://affpapa.org/en/nevibecode/skills/rest-api-django.md) — skill · 712 installs
- [spring-boot-rest-api-standards](https://affpapa.org/en/nevibecode/skills/spring-boot-rest-api-standards.md) — skill · 4200 installs
- [unit-test-wiremock-rest-api](https://affpapa.org/en/nevibecode/skills/unit-test-wiremock-rest-api.md) — skill · 3800 installs

From the same set: [wordpress/agent-skills](https://affpapa.org/en/nevibecode/by/wordpress/agent-skills.md) — 19 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
