Automattic\WooCommerce\StoreApi
Authentication::init()
Hook into WP lifecycle events. This is hooked by the StoreAPI class on rest_api_init.
Method of the class: Authentication{}
No Hooks.
Return
null
. Nothing (null).
Usage
$Authentication = new Authentication(); $Authentication->init();
Authentication::init() Authentication::init code WC 9.3.3
public function init() { if ( ! $this->is_request_to_store_api() ) { return; } add_filter( 'rest_authentication_errors', array( $this, 'check_authentication' ) ); add_action( 'set_logged_in_cookie', array( $this, 'set_logged_in_cookie' ) ); add_filter( 'rest_pre_serve_request', array( $this, 'send_cors_headers' ), 10, 3 ); add_filter( 'rest_allowed_cors_headers', array( $this, 'allowed_cors_headers' ) ); // Remove the default CORS headers--we will add our own. remove_filter( 'rest_pre_serve_request', 'rest_send_cors_headers' ); }