wppaste
WordPress

apply_filters( 'wp_register_ability_args', \array<string, , string $name )

Since
6.9.0
Filters the ability arguments before they are validated and used to instantiate the ability.

Compatibility

WordPress
since 6.9.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in 3 of the 5 tracked releases, added in 6.9.0.

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.
$namestring
The name of the ability, with its namespace.

Where this hook fires · 1

  • wp-includes/abilities-api/class-wp-abilities-registry.php:139WP_Abilities_Registry::register()

Source code

		 *                                                        Default is the value of `$public` when set, false otherwise.		 *     }		 *     @type string               $ability_class         Optional. Custom class to instantiate instead of WP_Ability.		 * }		 * @param string               $name The name of the ability, with its namespace.		 */		$args = apply_filters( 'wp_register_ability_args', $args, $name ); 		// Validate ability category exists if provided (will be validated as required in WP_Ability).		if ( isset( $args['category'] ) ) {			if ( ! wp_has_ability_category( $args['category'] ) ) {				_doing_it_wrong(					__METHOD__,

Changelog

Introduced in 6.9.0. Unchanged from 6.9.7 through 7.1.0.

  1. 6.9.7
  2. 7.0.4
  3. 7.1.0

Signature, return type and hooks compared across 3 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.