abilities.php
Registers the WordPress Abilities interface, checks whether AI access is enabled, applies per-user rate limits, and records a compact operation audit. Each ability delegates to the same page or design functions used elsewhere.
Responsibility#
Registers the WordPress Abilities interface, checks whether AI access is enabled, applies per-user rate limits, and records a compact operation audit. Each ability delegates to the same page or design functions used elsewhere.
This is an implementation reference for the released 0.9.13 module. Internal PHP helpers are not a compatibility promise for third-party callers. Prefer the documented REST, Abilities, theme, and filter contracts.
Related modules#
Literal option and cache keys#
cantata_edit_ai, cantata_edit_ai_audit. These are direct literal keys found in this module; dynamically constructed keys and metadata constants are covered by the storage reference.
WordPress hooks#
| Operation | Hook |
|---|---|
add_action |
wp_abilities_api_categories_init |
add_action |
wp_abilities_api_init |
add_action and add_filter subscribe to a hook; do_action and apply_filters expose a hook. A subscription is not itself a new extension API. Dynamic hook names are not included in this literal inventory.
Function and method reference#
cantata_edit_ai_enabled#
function cantata_edit_ai_enabled(): bool
True when AI tools may use the site: the wp-config constant decides if it's set, else the setting (off by default).
Source location: includes/abilities.php:17.
cantata_edit_ai_can#
function cantata_edit_ai_can( int $page_id = 0 )
Whether the current user may use AI access, on this page if one is given: true, or a WP_Error saying why not.
Implementation connections: cantata_edit_ai_enabled, cantata_edit_can_dev, cantata_edit_product_name.
Source location: includes/abilities.php:22.
cantata_edit_ai_via#
function cantata_edit_ai_via(): string
Who made a change, for History: the application password's name ("an authorized application"), "WP-CLI", or '' for an ordinary signed-in session.
Source location: includes/abilities.php:46.
cantata_edit_ai_rate_gate#
function cantata_edit_ai_rate_gate()
A conservative per-user ceiling with an explicit retry contract for automated clients.
Source location: includes/abilities.php:59.
cantata_edit_ai_audit#
function cantata_edit_ai_audit( string $ability, array $input, $result ): void
Keep a small administrator-visible trail without storing page words, prompts, credentials, or ability inputs.
Implementation connections: cantata_edit_ai_via.
Source location: includes/abilities.php:74.
cantata_edit_ai_schemas#
function cantata_edit_ai_schemas(): array
JSON Schema pieces the abilities share.
Implementation connections: cantata_edit_ai_audit, cantata_edit_ai_can, cantata_edit_ai_outline, cantata_edit_ai_rate_gate, cantata_edit_product_name.
Source location: includes/abilities.php:90.