New advertisers: 50% off your first month with code FIRSTMONTHSee slots
wordpress avatar

Wp Rest Api

Developer guide for building, extending, and debugging WordPress REST API routes, controllers, and schema validation.

skills.sh installs
6.6K
GitHub stars
2.4K
last updated
Aug 21, 2026
View on GitHub

What it does

  • Covers route registration, WP_REST_Controller classes, argument schemas, permission callbacks, and response shaping for custom endpoints
  • Includes reference files on custom content types, routes and endpoints, schema, responses and fields, authentication, and discovery and parameters
  • Enforces a required permission_callback on every route and capability checks rather than login-only authorization
  • Designed for WordPress plugin and theme developers targeting WordPress 7.0 or later and debugging 401, 403, or 404 errors

Install

$ npx -y skills add wordpress/agent-skills --skill wp-rest-api -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

WP REST API

When to use

Use this skill when you need to:

  • create or update REST routes/endpoints
  • debug 401/403/404 errors or permission/nonce issues
  • add custom fields/meta to REST responses
  • expose custom post types or taxonomies via REST
  • implement schema + argument validation
  • adjust response links/embedding/pagination

Inputs required

  • Repo root + target plugin/theme/mu-plugin (path to entrypoint).
  • Desired namespace + version (e.g. my-plugin/v1) and routes.
  • Authentication mode (cookie + nonce vs application passwords vs auth plugin).
  • Target WordPress version constraints (if below 7.0, call out).

Procedure

0) Triage and locate REST usage

  1. Run triage:
    • node skills/wp-project-triage/scripts/detect_wp_project.mjs
  2. Search for existing REST usage:
    • register_rest_route
    • WP_REST_Controller
    • rest_api_init
    • show_in_rest, rest_base, rest_controller_class

If this is a full site repo, pick the specific plugin/theme before changing code.

1) Choose the right approach

Details

Repository
github.com/wordpress/agent-skills
Categories
PHP & Laravel, Backend & APIs

More from wordpress/agent-skills

All 17

Similar to Wp Rest Api

More PHP & Laravel