wp-rest-api

Build and debug WordPress REST API endpoints with register_rest_route and WP_REST_Controller.

1|Updated Jan 31, 2026
One-click install
npx skills add https://github.com/javiercasares/cloudfest-wporgdownload --skill wp-rest-api
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wp-rest-api
Source: https://github.com/javiercasares/cloudfest-wporgdownload/tree/main/.claude/skills/wp-rest-api
Command: npx skills add https://github.com/javiercasares/cloudfest-wporgdownload --skill wp-rest-api

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

WordPress developers building or debugging REST API endpoints can rapidly implement routes, controllers, input validation, and response shaping, while ensuring proper authentication and data exposure via REST.

Core Features & Use Cases

  • Register REST routes with namespaces and versions using register_rest_route
  • Build or extend WP_REST_Controller classes and show_in_rest metadata for CPTs and taxonomies
  • Validate and sanitize request args using JSON schema and REST API patterns
  • Debug authorization issues (401/403) and respond with proper WP_Error structures
  • Use cases include creating custom endpoints for plugins or themes, exposing custom post types to REST, and secure data exposure

Quick Start

To begin, reference the skill to add a new REST endpoint using a namespace vendor/v1 and a route /plugin/v1/my-endpoint with a GET method and a permission_callback.

Frequently Asked Questions about wp-rest-api

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I register a custom WordPress REST API endpoint with a permission callback?

To register a WordPress REST API endpoint, use the register_rest_route function with a namespace and version, then define a GET method with a permission_callback to secure the route.

How do I expose custom post types and taxonomies to the WordPress REST API?

Exposing custom post types and taxonomies via the WordPress REST API involves extending WP_REST_Controller classes and configuring show_in_rest metadata for your custom content structures.

How do I validate and sanitize request arguments in a WordPress REST API route?

Validate and sanitize WordPress REST API request arguments by applying JSON schema validation and REST API patterns to ensure incoming data matches expected formats before processing.

Why am I getting a 401 or 403 authorization error on my WordPress REST API endpoint?

Debugging 401 or 403 authorization errors on WordPress REST API endpoints requires checking your authentication patterns and permission_callback logic to ensure proper secure data exposure.

Can I build custom REST controllers for my WordPress plugin across different environments?

You can build and extend WP_REST_Controller classes for your WordPress plugin across themes, plugins, or mu-plugins to shape responses and structure custom endpoint logic.

What is the best way to return proper error structures from a WordPress REST API route?

The best way to return error structures from a WordPress REST API route is responding with WP_Error structures to maintain consistent JSON schema validation and REST API patterns.