woocommerce_rest_api_get_rest_namespaces
Filter the list of REST API controllers to load.
Использование
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(массив)
- List of $namespace => $controllers to load.
Список изменений
| С версии 4.5.0 | Введена. |
Где вызывается хук
woocommerce_rest_api_get_rest_namespaces
woocommerce/includes/rest-api/Server.php 93
return apply_filters( 'woocommerce_rest_api_get_rest_namespaces', $namespaces );
Где используется хук в 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' ) );