woocommerce_rest_api_get_rest_namespaces
Get API namespaces - new namespaces should be registered here.
Usage
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
- -
Where the hook is called
woocommerce_rest_api_get_rest_namespaces
woocommerce/includes/rest-api/Server.php 60-68
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(), ) );
Where the hook is used in WooCommerce
woocommerce/includes/wccom-site/class-wc-wccom-site.php 33
add_action( 'woocommerce_rest_api_get_rest_namespaces', array( __CLASS__, 'register_rest_namespace' ) );
woocommerce/src/Internal/RestApiControllerBase.php 122
static::add_filter( 'woocommerce_rest_api_get_rest_namespaces', array( $this, 'handle_woocommerce_rest_api_get_rest_namespaces' ) );