wp-abilities-api

Register WordPress Abilities API categories and abilities with REST exposure.

Updated Jan 29, 2026
One-click install
npx skills add https://github.com/HungNth/wordpress-notify-nth --skill wp-abilities-api-hungnth
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: wp-abilities-api
Source: https://github.com/HungNth/wordpress-notify-nth/tree/main/.opencode/skills/wp-abilities-api
Command: npx skills add https://github.com/HungNth/wordpress-notify-nth --skill wp-abilities-api-hungnth

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

WordPress developers often struggle to implement and expose the Abilities API in a consistent, re-usable way across PHP back-ends and front-end clients. This skill provides a structured approach to registering categories and abilities, wiring them to the correct lifecycle hooks, and exposing them via REST so that clients can query capability metadata.

Core Features & Use Cases

  • Category & Ability Registration: Register categories and abilities in the correct lifecycle hooks to ensure proper initialization.
  • REST Exposure: Mark abilities with meta.show_in_rest and verify endpoints under wp-json/wp-abilities/v1.
  • Client Consumption: Use @wordpress/abilities on the frontend to read and enforce permissions.

Quick Start

Define a new category and an ability in your plugin, then hook them into wp_abilities_api_categories_init and wp_abilities_api_init respectively. Ensure the ability metadata includes meta.show_in_rest and verify the endpoints under wp-json/wp-abilities/v1 return the expected data.

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 plugin permissions to a front-end client?

To expose plugin permissions to a front-end client, you register capabilities using the WordPress Abilities API and mark them with meta.show_in_rest. This makes permission metadata queryable via the wp-json/wp-abilities/v1 REST endpoints.

When do I need to use the WordPress Abilities API lifecycle hooks?

You need to use the Abilities API lifecycle hooks when registering custom categories and abilities to ensure proper initialization. Hook into wp_abilities_api_categories_init for categories and wp_abilities_api_init for abilities during plugin or theme development.

Does the WordPress Abilities API require a specific version of WordPress?

Yes, the WordPress Abilities API requires version 6.9 or higher for proper compatibility. You must ensure your plugin or theme development environment meets this version requirement to utilize the REST exposure and PHP registration hooks correctly.

What is the best way to structure WordPress permissions for REST exposure?

The best way to structure permissions for REST exposure is to define distinct categories and abilities, then wire them into their respective lifecycle hooks. Ensure ability metadata includes show_in_rest to verify endpoints under wp-json/wp-abilities/v1 return expected data.

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

Abilities may not show in the REST API if the meta.show_in_rest flag is missing or if registration occurs outside the wp_abilities_api_init hook. Verify proper lifecycle hook attachment and metadata configuration to expose endpoints correctly.