woocommerce_rest_query_vars хук-фильтрWC 1.0

Filter allowed query vars for the REST API.

This filter allows you to add or remove query vars from the final allowed list for all requests, including unauthenticated ones. To alter the vars for editors only.

Использование

add_filter( 'woocommerce_rest_query_vars', 'wp_kama_woocommerce_rest_query_vars_filter' );

/**
 * Function for `woocommerce_rest_query_vars` filter-hook.
 * 
 * @param array $valid_vars { Array of allowed WP_Query query vars.

```php
@param string $allowed_query_var The query var to allow.

}
*

  • @return array
    */
    function wp_kama_woocommerce_rest_query_vars_filter( $valid_vars ){

    // filter...
    return $valid_vars;
    }

    
    
$valid_vars(массив)
{ Array of allowed WP_Query query vars.
@param string $allowed_query_var The query var to allow.

}

Где вызывается хук

WC_REST_Posts_Controller::get_allowed_query_vars()
woocommerce_rest_query_vars
woocommerce/includes/rest-api/Controllers/Version3/class-wc-rest-posts-controller.php 608
$valid_vars = apply_filters( 'woocommerce_rest_query_vars', $valid_vars );

Где используется хук в WooCommerce

Использование не найдено.