rest_api_init action-hookWC 1.0

This is a WordPress - rest_api_init hook. The plugin just uses it.

Fires when preparing to serve a REST API request.

Usage

add_action( 'rest_api_init', 'wp_kama_rest_api_init_action' );

/**
 * Function for `rest_api_init` action-hook.
 * 
 * @param WP_REST_Server $wp_rest_server Server object.
 *
 * @return void
 */
function wp_kama_rest_api_init_action( $wp_rest_server ){

	// action...
}
$wp_rest_server(WP_REST_Server)
Server object.

Where the hook is called

WC_CLI_Runner::after_wp_load()
rest_api_init
woocommerce/includes/cli/class-wc-cli-runner.php 59
do_action( 'rest_api_init', $wp_rest_server );

Where the hook is used in WooCommerce

woocommerce/includes/admin/helper/class-wc-helper-admin.php 30
add_filter( 'rest_api_init', array( __CLASS__, 'register_rest_routes' ) );
woocommerce/includes/admin/helper/class-wc-helper-orders-api.php 24
add_filter( 'rest_api_init', array( __CLASS__, 'register_rest_routes' ) );
woocommerce/includes/admin/helper/class-wc-helper-subscriptions-api.php 26
add_filter( 'rest_api_init', array( __CLASS__, 'register_rest_routes' ) );
woocommerce/includes/class-wc-api.php 29
add_action( 'rest_api_init', array( $this, 'register_wp_admin_settings' ) );
woocommerce/includes/rest-api/Server.php 32
add_action( 'rest_api_init', array( $this, 'register_rest_routes' ), 10 );
woocommerce/src/Admin/API/Init.php 48
add_action( 'rest_api_init', array( $this, 'rest_api_init' ) );
woocommerce/src/Admin/Features/ProductBlockEditor/Init.php 78
add_action( 'rest_api_init', array( $this, 'register_layout_templates' ) );
woocommerce/src/Admin/Features/ProductBlockEditor/Init.php 79
add_action( 'rest_api_init', array( $this, 'register_user_metas' ) );
woocommerce/src/Blocks/Shipping/ShippingController.php 66
add_action( 'rest_api_init', array( $this, 'register_settings' ) );
woocommerce/src/Internal/Admin/WCAdminUser.php 21
add_action( 'rest_api_init', array( $this, 'register_user_data' ) );