woocommerce_rest_api_get_rest_namespaces
Filter the list of REST API controllers to load.
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 $controllers List of $namespace => $controllers to load.
*
* @return array
*/
function wp_kama_woocommerce_rest_api_get_namespaces_filter( $controllers ){
// filter...
return $controllers;
}
- $controllers(array)
- List of $namespace => $controllers to load.
Changelog
| Since 4.5.0 | Introduced. |
Where the hook is called
woocommerce_rest_api_get_rest_namespaces
woocommerce/includes/rest-api/Server.php 93
return apply_filters( 'woocommerce_rest_api_get_rest_namespaces', $namespaces );
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 88
add_filter( 'woocommerce_rest_api_get_rest_namespaces', array( $this, 'handle_woocommerce_rest_api_get_rest_namespaces' ) );