wp-rest-api

Register WordPress REST API routes and debug endpoint responses.

3|Updated Feb 21, 2026
One-click install
npx skills add https://github.com/ihatesea69/HieuNghi-AI-Skills --skill wp-rest-api-ihatesea69
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wp-rest-api
Source: https://github.com/ihatesea69/HieuNghi-AI-Skills/tree/main/wordpress_skills/wp-rest-api
Command: npx skills add https://github.com/ihatesea69/HieuNghi-AI-Skills --skill wp-rest-api-ihatesea69

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 and robust functionality for custom WordPress applications.

Core Features & Use Cases

  • Endpoint Creation: Register new REST routes and endpoints for custom post types, taxonomies, or specific data.
  • Debugging: Resolve common issues like 401/403/404 errors, permission problems, and incorrect responses.
  • Data Shaping: Add custom fields, meta, and control response structure for optimal client consumption.
  • Use Case: You need to expose a custom post type's data via the REST API for a headless WordPress setup. This Skill will guide you through registering the CPT with show_in_rest and ensuring its fields are accessible.

Quick Start

Use the wp-rest-api skill to register a new REST route for the 'my-plugin/v1' namespace that handles GET requests for '/items'.

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 in the WordPress REST API for a headless setup?

To expose custom post types in the WordPress REST API, register your post type with `show_in_rest` enabled. This makes your custom content accessible via REST endpoints for headless WordPress data consumption.

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

WordPress REST API endpoints return 404 or 403 errors due to incorrect route registration or failed permission callbacks. Debugging involves verifying namespace structures and ensuring user capabilities meet endpoint permission requirements.

How do I add custom fields to WordPress REST API responses?

Add custom fields to WordPress REST API responses by registering meta and shaping the response structure within your controller. This controls data exposure for optimal client consumption and ensures schema validation.

Does the WordPress REST API require specific PHP or WordPress versions?

The WordPress REST API requires WordPress 6.9 or higher and PHP 7.2.24 at a minimum. Optional WP-CLI workflows are supported for managing and debugging endpoint generation from the command line.

What is the best way to register a new REST route in WordPress?

The best way to register a new WordPress REST route is by using `register_rest_route` within a defined namespace like 'my-plugin/v1'. You must specify the route path, HTTP methods like GET, and permission callbacks.

How does schema validation work for custom WordPress REST API endpoints?

Schema validation for custom WordPress REST API endpoints ensures data integrity by validating request parameters against defined schemas. It shapes responses and verifies data formats before executing controller logic.