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

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
-

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

Server::get_rest_namespaces()
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(),
	)
);

Где используется хук в 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' ) );