acf/validate_rest_value/type=(type)
Filters whether a value passed via REST is valid.
Использование
add_filter( 'acf/validate_rest_value/type=(type)', 'wp_kama_acf_validate_rest_value_type_filter', 10, 3 ); /** * Function for `acf/validate_rest_value/type=(type)` filter-hook. * * @param bool $valid True if the value is valid, false or WP_Error if not. * @param mixed $value The value to check. * @param array $field An array of information about the field. * * @return bool */ function wp_kama_acf_validate_rest_value_type_filter( $valid, $value, $field ){ // filter... return $valid; }
- $valid(true|false)
- True if the value is valid, false or WP_Error if not.
- $value(разное)
- The value to check.
- $field(массив)
- An array of information about the field.
Список изменений
С версии 5.11 | Введена. |
Где вызывается хук
acf/validate_rest_value/type=(type)
acf/includes/rest-api/class-acf-rest-api.php 176
$valid = apply_filters( 'acf/validate_rest_value/type=' . $field['type'], true, $field_value, $field );