wp-abilities-api

Register WordPress Abilities API entries with REST exposure and hooks.

9|1|Updated Sep 10, 2022
One-click install
npx skills add https://github.com/WPdoaction/animal-shelter --skill wp-abilities-api
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: wp-abilities-api
Source: https://github.com/WPdoaction/animal-shelter/tree/main/.claude/skills/wp-abilities-api
Command: npx skills add https://github.com/WPdoaction/animal-shelter --skill wp-abilities-api

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

WordPress projects often need structured, permission-based access to features. This Skill provides a guide to register and expose WordPress Abilities API entries so client code can reliably check permissions and UI gating.

Core Features & Use Cases

  • Category & Ability Registration: Implement wp_register_ability_category and wp_register_ability in PHP to define capabilities.
  • REST Exposure: Expose abilities via the wp-abilities/v1 REST endpoints for clients.
  • Client Consumption: Use @wordpress/abilities in JS to query and enforce permissions in UIs.
  • Use Case: A plugin needs a site-info ability accessible to admin clients but hidden from standard users.

Quick Start

Install and configure your WP project to load the skill, then add registration examples to a plugin or mu-plugin and ensure the wp_abilities_api_categories_init and wp_abilities_api_init hooks fire.

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 via REST for client-side checks?▼

To expose WordPress permissions via REST, register abilities using wp_register_ability and wp_register_ability_category in PHP. This populates the wp-abilities/v1 REST endpoints, allowing clients to query and enforce UI gating based on user capabilities.

What is the WordPress Abilities API and when do I need it for theme development?▼

The WordPress Abilities API provides structured, permission-based access to features. You need it when building themes or plugins that require reliable permission controls and UI gating for clients consuming REST endpoints.

How do I register a custom ability category in WordPress using PHP hooks?▼

Register a custom ability category in WordPress by calling wp_register_ability_category in your plugin. Ensure the wp_abilities_api_categories_init and wp_abilities_api_init hooks fire correctly to manage lifecycle registration and meta settings like show_in_rest.

Can I use JavaScript to query WordPress permissions exposed through the REST API?▼

Yes, you can query WordPress permissions in JavaScript using the @wordpress/abilities package. This client-side library consumes the wp-abilities/v1 REST endpoints to check permissions and enforce UI access dynamically.

Does the WordPress Abilities API support restricting REST endpoint access to admins only?▼

Yes, the WordPress Abilities API supports restricting REST endpoint access. By defining a site-info ability with specific permission controls, you can make features accessible to admin clients while hiding them from standard users.