WP HOOKS
filtrod 6.9.0

wp_register_ability_args

Args 2Plik wp-includes/abilities-api/class-wp-abilities-registry.phpDokumentacja WP ↗

Opis — z kodu źródłowego

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

Parametry

ParametrTypOpis
$argsarray<string,mixed>{ 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&lt;string, mixed&gt; $input_schema Optional. JSON Schema definition for the ability's input. @type array&lt;string, mixed&gt; $output_schema Optional. JSON Schema definition for the ability's output. @type array&lt;string, mixed&gt; $meta { Optional. Additional metadata for the ability. @type array&lt;string, bool|string&gt; $annotations Optional. Annotation metadata for the ability. @type bool $show_in_rest Optional. Whether to expose this ability in the REST API. Default false. } @type string $ability_class Optional. Custom class to instantiate instead of WP_Ability. }
$namestringThe name of the ability, with its namespace.

Wywołanie

Rejestracja callbackaphp
// rejestracja funkcji zwrotnej — podaj liczbę argumentów!
add_filter( 'wp_register_ability_args', 'twoja_funkcja', 10, 2 );

function twoja_funkcja($param_1, $param_2) {
	// Twój kod
}

Popularne w tej kategorii