wp-abilities-api

Registers WordPress Abilities and categories and exposes them via REST API.

Updated Jan 13, 2026
One-click install
npx skills add https://github.com/MrGKanev/agent-skills --skill wp-abilities-api-mrgkanev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wp-abilities-api
Source: https://github.com/MrGKanev/agent-skills/tree/main/skills/wp-abilities-api
Command: npx skills add https://github.com/MrGKanev/agent-skills --skill wp-abilities-api-mrgkanev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill helps teams define and register WordPress Abilities and categories, exposing them through the REST API to enable client-side consumption and consistent permission checks.

Core Features & Use Cases

  • Category-first registration: Register ability categories early (e.g., via wp_abilities_api_categories_init) and then register abilities (wp_abilities_api_init).
  • REST exposure: Use meta.show_in_rest to expose abilities under wp-abilities/v1 and make them searchable by clients.
  • Use Case: A plugin wants to provide a controlled capability surface to a JS app, ensuring only approved actions are visible via REST.

Quick Start

Create a PHP plugin that registers a new category and an ability inside the proper hooks, enable REST exposure, then verify endpoints at /wp-json/wp-abilities/v1/abilities and /wp-json/wp-abilities/v1/categories.

Frequently Asked Questions about wp-abilities-api

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

FAQPage Schema
How do I expose WordPress abilities via REST API for client-side permissions checks?

To expose WordPress abilities via REST, register ability categories using wp_abilities_api_categories_init and abilities using wp_abilities_api_init, then enable meta.show_in_rest. Clients can then query endpoints under wp-abilities/v1 to consume structured permissions.

What WordPress version is required to register abilities and categories via the REST API?

Registering abilities and categories via REST requires WordPress 6.9 or higher. You must also use the specific Abilities API hooks, wp_abilities_api_categories_init and wp_abilities_api_init, for proper category-first registration placement.

When do I need to use category-first registration for WordPress abilities?

Category-first registration is needed when defining structured permissions for a JS application. Register ability categories early via wp_abilities_api_categories_init, then register the actual abilities inside wp_abilities_api_init to ensure a controlled capability surface.

What is the best way to make a controlled plugin capability surface visible to a JavaScript app?

The best way to provide a controlled capability surface to a JS app is registering abilities in PHP with meta.show_in_rest enabled. This exposes only approved actions via the wp-abilities/v1 REST endpoints for secure client-side consumption.

How do I verify that my registered WordPress abilities are exposed correctly via REST?

Verify your exposed WordPress abilities by checking the /wp-json/wp-abilities/v1/abilities and /wp-json/wp-abilities/v1/categories endpoints. Ensure meta.show_in_rest is enabled during the wp_abilities_api_init hook for successful REST exposure.

Why are my WordPress abilities not showing up in the REST API endpoints?

WordPress abilities may not show in REST if registered outside the wp_abilities_api_init hook, or if meta.show_in_rest is not enabled. Ensure your environment is WordPress 6.9+ and categories are registered first using wp_abilities_api_categories_init.