Filters the ability arguments before they are validated and used to instantiate the ability.
Parameters
\array<string,
mixed> $args { An associative array of arguments for the ability. @type string $label The human-readable label for the ability. @type string $description A detailed description of what the ability does. @type string $category The ability category slug this ability belongs to. @type callable $execute_callback A callback function to execute when the ability is invoked. Receives optional mixed input and returns mixed result or WP_Error. @type callable $permission_callback A callback function to check permissions before execution. Receives optional mixed input and returns bool or WP_Error. @type array<string, mixed> $input_schema Optional. JSON Schema definition for the ability's input. @type array<string, mixed> $output_schema Optional. JSON Schema definition for the ability's output. @type array<string, mixed> $meta { Optional. Additional metadata for the ability. @type array<string, bool|string> $annotations Optional. Annotation metadata for the ability. @type bool $public Optional. Whether the ability is meant to be available to clients such as the REST API, MCP, or AI agents. Seeds the default for per-channel flags like $show_in_rest. Defaults to false. @type bool $show_in_rest Optional. Whether to expose this ability in the REST API. Default is the value of $public when set, false otherwise. } @type string $ability_class Optional. Custom class to instantiate instead of WP_Ability.}
$labelstring
The human-readable label for the ability.
$descriptionstring
A detailed description of what the ability does.
$categorystring
The ability category slug this ability belongs to.
$execute_callbackcallable
A callback function to execute when the ability is invoked. Receives optional mixed input and returns mixed result or WP_Error.
$permission_callbackcallable
A callback function to check permissions before execution. Receives optional mixed input and returns bool or WP_Error.
mixedarray<string,
> $input_schema Optional. JSON Schema definition for the ability's input.
mixedarray<string,
> $output_schema Optional. JSON Schema definition for the ability's output.
mixedarray<string,
> $meta { Optional. Additional metadata for the ability.
boolarray<string,
|string> $annotations Optional. Annotation metadata for the ability.
$publicbool
Optional. Whether the ability is meant to be available to clients such as the REST API, MCP, or AI agents. Seeds the default for per-channel flags like $show_in_rest. Defaults to false.
$show_in_restbool
Optional. Whether to expose this ability in the REST API. Default is the value of $public when set, false otherwise. } @type string $ability_class Optional. Custom class to instantiate instead of WP_Ability.
133*Default is the value of `$public` when set,false otherwise.134*}135* @type string$ability_class Optional. Custom classto instantiate instead of WP_Ability.136*}137* @param string$name The name of the ability, with its namespace.138*/139$args=apply_filters('wp_register_ability_args',$args,$name);140141// Validate ability category exists if provided (will be validated as required in WP_Ability).142if(isset($args['category'])){143if(!wp_has_ability_category($args['category'])){144_doing_it_wrong(145__METHOD__,
History
Introduced in 6.9.0. Unchanged from 6.9.7 through 7.1.0.