wp-rest-api

Develop, extend, and debug WordPress REST API endpoints and routes.

2|Updated Aug 16, 2025
One-click install
npx skills add https://github.com/brigleb/claude --skill wp-rest-api-brigleb
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wp-rest-api
Source: https://github.com/brigleb/claude/tree/main/skills/wp-rest-api
Command: npx skills add https://github.com/brigleb/claude --skill wp-rest-api-brigleb

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill streamlines the development and troubleshooting of WordPress REST API endpoints, ensuring seamless data exchange for custom functionalities and integrations.

Core Features & Use Cases

  • Endpoint Registration: Create new REST routes and endpoints for custom post types, taxonomies, or specific data.
  • Debugging: Resolve 401/403/404 errors, permission issues, and authentication problems.
  • Data Shaping: Define schemas, validate arguments, and customize response fields and links.
  • Use Case: You need to expose a custom post type's data via the WordPress REST API. This Skill will guide you through registering the necessary routes, setting permissions, and ensuring the data is correctly formatted in the response.

Quick Start

Use the wp-rest-api skill to register a new REST endpoint for your custom post type 'products' under the namespace 'my-plugin/v1'.

Frequently Asked Questions about wp-rest-api

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

FAQPage Schema
How do I expose custom post types and taxonomies through the WordPress REST API?

To expose custom post types via the WordPress REST API, you register custom routes using `register_rest_route` and configure `WP_REST_Controller` classes to shape the response data. This process defines endpoints for your data, sets permission callbacks, and ensures schema validation for seamless integrations.

Why does my WordPress REST API endpoint return a 404 or 403 error?

WordPress REST API 404 or 403 errors typically occur due to missing permission callbacks or incorrect route registration. Debugging involves verifying your `register_rest_route` configuration, ensuring proper authentication workflows, and validating that your custom post types are correctly exposed to resolve permission issues.

Do I need WP-CLI to debug WordPress REST API routes?

WP-CLI is not strictly required for all WordPress REST API debugging but may be necessary for certain workflows and environment setups. The Skill supports WordPress 6.9+ and PHP 7.2.24+, utilizing WP-CLI to streamline specific endpoint troubleshooting and route validation tasks when needed.

How do I validate arguments and shape responses for custom REST endpoints in WordPress?

To validate arguments and shape responses for WordPress REST endpoints, you define schemas within your `WP_REST_Controller` classes. This configuration allows you to customize response fields, validate incoming data against your schema, and manage links for your custom post types effectively.

What is the best way to register a new route for a custom post type in WordPress?

The best way to register a route for a custom post type is to use `register_rest_route` under a specific namespace like 'my-plugin/v1'. You then implement `WP_REST_Controller` to handle schema validation, define permission callbacks, and format the custom post type data in the JSON response.