Automattic\WooCommerce\Internal\Integrations
WPConsentAPI::on_init()
Register our hooks on init.
Метод класса: WPConsentAPI{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->on_init();
Код WPConsentAPI::on_init() WPConsentAPI::on init WC 9.3.3
protected function on_init() { // Include integration to WP Consent Level API if available. if ( ! $this->is_wp_consent_api_active() ) { return; } $plugin = plugin_basename( WC_PLUGIN_FILE ); add_filter( "wp_consent_api_registered_{$plugin}", '__return_true' ); add_action( 'wp_enqueue_scripts', function() { $this->enqueue_consent_api_scripts(); } ); /** * Modify the "allowTracking" flag consent if the user has consented to marketing. * * Wp-consent-api will initialize the modules on "init" with priority 9, * So this code needs to be run after that. */ add_filter( 'wc_order_attribution_allow_tracking', function() { return function_exists( 'wp_has_consent' ) && wp_has_consent( self::$consent_category ); } ); }