woocommerce_rest_api_get_rest_namespaces
Get API namespaces - new namespaces should be registered here.
Использование
add_filter( 'woocommerce_rest_api_get_rest_namespaces', 'wp_kama_woocommerce_rest_api_get_namespaces_filter' ); /** * Function for `woocommerce_rest_api_get_rest_namespaces` filter-hook. * * @param $array * * @return */ function wp_kama_woocommerce_rest_api_get_namespaces_filter( $array ){ // filter... return $array; }
- $array
- -
Где вызывается хук
woocommerce_rest_api_get_rest_namespaces
woocommerce/includes/rest-api/Server.php 54-62
return apply_filters( 'woocommerce_rest_api_get_rest_namespaces', array( 'wc/v1' => $this->get_v1_controllers(), 'wc/v2' => $this->get_v2_controllers(), 'wc/v3' => $this->get_v3_controllers(), 'wc-telemetry' => $this->get_telemetry_controllers(), ) );
Где используется хук в WooCommerce
woocommerce/includes/wccom-site/class-wc-wccom-site.php 33
add_action( 'woocommerce_rest_api_get_rest_namespaces', array( __CLASS__, 'register_rest_namespace' ) );