Automattic\WooCommerce\Blocks\Domain\Services
Notices::init
Initialize notice hooks.
Method of the class: Notices{}
Hooks from the method
Returns
null. Nothing (null).
Usage
$Notices = new Notices(); $Notices->init();
Notices::init() Notices::init code WC 10.3.5
public function init() {
add_action(
'after_setup_theme',
function () {
/**
* Allow classic theme developers to opt-in to using block notices.
*
* @since 8.8.0
* @param bool $use_block_notices_in_classic_theme Whether to use block notices in classic theme.
* @return bool
*/
if ( wp_is_block_theme() || apply_filters( 'woocommerce_use_block_notices_in_classic_theme', false ) ) {
add_filter( 'wc_get_template', [ $this, 'get_notices_template' ], 10, 5 );
}
}
);
add_filter( 'woocommerce_kses_notice_allowed_tags', [ $this, 'add_kses_notice_allowed_tags' ] );
add_action( 'wp_head', [ $this, 'enqueue_notice_styles' ] );
}