woocommerce_blocks_loaded хук-событиеWC 2.5.0

Fires when the woocommerce blocks are loaded and ready to use.

This hook is intended to be used as a safe event hook for when the plugin has been loaded, and all dependency requirements have been met.

To ensure blocks are initialized, you must use the woocommerce_blocks_loaded instead of the plugins_loaded This is because the functions hooked into plugins_loaded on the same priority load in an inconsistent and unpredictable manner.


add_action( 'woocommerce_blocks_loaded', 'wp_kama_woocommerce_blocks_loaded_action' );

 * Function for `woocommerce_blocks_loaded` action-hook.
 * @return void
function wp_kama_woocommerce_blocks_loaded_action(){

	// action...

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

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

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


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

woocommerce/src/Internal/Admin/WCAdminSharedSettings.php 35
add_action( 'woocommerce_blocks_loaded', array( $this, 'on_woocommerce_blocks_loaded' ), 10 );