woocommerce_store_api_disable_nonce_check хук-фильтрWC 4.5.0

Filters the Store API nonce check.

This can be used to disable the nonce check when testing API endpoints via a REST API client.

Использование

add_filter( 'woocommerce_store_api_disable_nonce_check', 'wp_kama_woocommerce_store_api_disable_nonce_check_filter' );

/**
 * Function for `woocommerce_store_api_disable_nonce_check` filter-hook.
 * 
 * @param boolean $disable_nonce_check If true, nonce checks will be disabled.
 *
 * @return boolean
 */
function wp_kama_woocommerce_store_api_disable_nonce_check_filter( $disable_nonce_check ){

	// filter...
	return $disable_nonce_check;
}
$disable_nonce_check(true|false)
If true, nonce checks will be disabled.

Список изменений

С версии 4.5.0 Введена.

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

AbstractCartRoute::check_nonce()
woocommerce_store_api_disable_nonce_check
woocommerce/src/StoreApi/Routes/V1/AbstractCartRoute.php 316
if ( apply_filters( 'woocommerce_store_api_disable_nonce_check', false ) ) {

Где используется хук в WooCommerce

woocommerce/src/Blocks/Domain/Services/Hydration.php 199
add_filter( 'woocommerce_store_api_disable_nonce_check', array( $this, 'disable_nonce_check_callback' ) );
woocommerce/src/Blocks/Domain/Services/Hydration.php 214
remove_filter( 'woocommerce_store_api_disable_nonce_check', array( $this, 'disable_nonce_check_callback' ) );