wp_ability_normalize_input
Filters the normalized input for an ability.
Fires after normalize_input() has applied any default value declared in the input schema, giving plugins a chance to adjust the input before it is consumed downstream. Common uses include defaulting beyond what JSON Schema can express, prompt enrichment, and injecting caller metadata.
Returning a WP_Error causes callers that propagate it (such as execute()) to halt before validation, permission checks, and the registered execute callback.
Использование
add_filter( 'wp_ability_normalize_input', 'wp_kama_ability_normalize_input_filter', 10, 3 );
/**
* Function for `wp_ability_normalize_input` filter-hook.
*
* @param mixed $input The normalized input data.
* @param string $ability_name The name of the ability.
* @param WP_Ability $ability The ability instance.
*
* @return mixed
*/
function wp_kama_ability_normalize_input_filter( $input, $ability_name, $ability ){
// filter...
return $input;
}
- $input(разное)
- The normalized input data.
- $ability_name(строка)
- The name of the ability.
- $ability(WP_Ability)
- The ability instance.
Список изменений
| С версии 7.1.0 | Введена. |
Где вызывается хук
wp_ability_normalize_input
wp-includes/abilities-api/class-wp-ability.php 508
return apply_filters( 'wp_ability_normalize_input', $input, $this->name, $this );