How it works
Ability naming, categories, the response envelope, permissions, and error handling
Every ACPT ability follows the same shape. Understanding this once means you can predict the request/response contract of all 57 abilities without reading each one individually.
Naming convention
All ability names use ACPT's acpt/ namespace, followed by a lowercase, hyphen-separated verb-noun pair — matching the Abilities API naming rules (lowercase alphanumeric and hyphens only, no underscores):
acpt/list-post-types
acpt/get-post-type
acpt/save-post-type
acpt/delete-post-typeMost domains expose the same four operations — list, get, save, delete — with two exceptions:
Taxonomies add two extra abilities to attach/detach a taxonomy from a post type:
acpt/assoc-taxonomy-post-typeandacpt/remove-taxonomy-post-type-assoc.Form fields have no
listability, sinceacpt/get-formalready returns a form's fields array — a separate listing ability would just duplicate it.
Categories
Abilities are grouped into two categories, registered on WordPress's wp_abilities_api_categories_init hook:
acpt-content-model
Defining your content structure: custom post types, taxonomies, meta field groups/boxes/fields, option pages, forms, form fields, dynamic blocks
acpt-content-data
Reading and writing content values: field values on posts, terms, users, comments and option pages
The split matters because content-model abilities default to a stricter capability (manage_options) than content-data abilities (edit_posts) — see Permissions below.
The response envelope
Every ability's execute_callback returns one of two things:
On success, a plain array shaped like this (validated against the ability's output_schema):
dataholds whatever the operation returns — a single object forget/saveabilities, an array forlistabilities, or is simply absent fordeleteabilities and abilities that don't return a resource (e.g.acpt/assoc-taxonomy-post-type).Objects and arrays returned by ACPT's internal models are normalized into plain JSON-friendly data before being placed in
data— you never receive a raw PHP object or aWP_Post_Typeinstance.
On failure, a WP_Error instead of an array — this is standard Abilities API / WordPress convention, so any Abilities API consumer already knows how to handle it:
Two error codes are used across all ACPT abilities:
acpt_ability_failed
The underlying ACPT operation failed — invalid input, item not found, or a validation error. The message is ACPT's own error message where available, otherwise a generic per-ability fallback (e.g. "Unable to save the custom post type.").
acpt_ability_forbidden
The current user doesn't have the required capability. See Permissions.
Permissions
Every ability has a permission_callback that checks a WordPress capability with current_user_can():
Abilities in the
acpt-content-modelcategory default tomanage_options.Abilities in the
acpt-content-datacategory (field values) default toedit_posts— a lower bar, since reading/writing field values is closer to everyday content editing than redesigning the content model.
Both defaults can be overridden — per-ability, per-user, or based on the input being sent — via the acpt/abilities-api/capability filter. See Extending.
Read/write/destructive metadata
Every registered ability also carries standard Abilities API annotations in its meta, so AI agents and MCP clients can reason about risk before calling something:
readonly
true for list/get abilities, false otherwise
destructive
true for delete abilities (and acpt/remove-taxonomy-post-type-assoc), false otherwise
idempotent
true for every ACPT ability — calling the same save twice with the same input produces the same end state, thanks to the upsert behavior described above
show_in_rest
true for every ACPT ability
What actually gets called
Each ability wraps an existing, already-tested piece of ACPT: either one of the documented PHP functions (register_acpt_post_type(), save_acpt_meta_group(), get_acpt_field(), …) or, where no such function exists (e.g. listing all post types), the same repository classes ACPT's admin UI uses internally. No business logic is duplicated — the Abilities API integration is purely a thin, schema-validated wrapper around ACPT's existing API surface.
Last updated