woocommerce_admin_rest_controllers filter-hookWC 3.5.0

Filter for the WooCommerce Admin REST controllers.

Admin and Analytics controllers were originally loaded in one place. However, with attempts to dynamically load namespaces based on context, these were split up. However, to maintain backward compatibility, we must run this hook if either namespace is loaded because extensions could be targeting either namespace.

Usage

add_filter( 'woocommerce_admin_rest_controllers', 'wp_kama_woocommerce_admin_rest_controllers_filter' );

/**
 * Function for `woocommerce_admin_rest_controllers` filter-hook.
 * 
 * @param array $controllers List of rest API controllers.
 *
 * @return array
 */
function wp_kama_woocommerce_admin_rest_controllers_filter( $controllers ){

	// filter...
	return $controllers;
}
$controllers(array)
List of rest API controllers.

Changelog

Since 3.5.0 Introduced.

Where the hook is called

Init::rest_api_init_wc_admin()
woocommerce_admin_rest_controllers
Init::rest_api_init_wc_analytics()
woocommerce_admin_rest_controllers
woocommerce/src/Admin/API/Init.php 120
$controllers = apply_filters( 'woocommerce_admin_rest_controllers', $controllers );
woocommerce/src/Admin/API/Init.php 209
$controllers = apply_filters( 'woocommerce_admin_rest_controllers', $controllers );

Where the hook is used in WooCommerce

Usage not found.