acf/rest/get_fields
Filter the fields available to the REST API.
Использование
add_filter( 'acf/rest/get_fields', 'wp_kama_acf_rest_get_fields_filter', 10, 3 ); /** * Function for `acf/rest/get_fields` filter-hook. * * @param array $fields The ACF fields for this field group. * @param array $resource Contextual information about the current resource request. * @param string $http_method The HTTP method of the current request (GET, POST, PUT, PATCH, DELETE, OPTION, HEAD). * * @return array */ function wp_kama_acf_rest_get_fields_filter( $fields, $resource, $http_method ){ // filter... return $fields; }
- $fields(массив)
- The ACF fields for this field group.
- $resource(массив)
- Contextual information about the current resource request.
- $http_method(строка)
- The HTTP method of the current request (GET, POST, PUT, PATCH, DELETE, OPTION, HEAD).
Где вызывается хук
acf/rest/get_fields
acf/includes/rest-api/class-acf-rest-api.php 554
return (array) apply_filters( 'acf/rest/get_fields', $fields, $resource, $http_method );