=== ubk-cookie-consent === Contributors: kamilpesekubkcz Requires at least: 5.3 Tested up to: 5.8 Requires PHP: 7.4 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Stable tag: 1.0.0 This plugin implements orestbida/cookieconsent solution and stores consents in custom database table. Google Tag Manager consent mode is supported by default. == Description == # Filters/hooks Set for which Wordpress role cookie settings will be available ` add_filter('ubk_cookie_consent/options_capability', static function ($optionsCapability) { return 'custom_capability'; }); ` Adjust options passed to Javascript. See [https://github.com/orestbida/cookieconsent/#all-configuration-options](https://github.com/orestbida/cookieconsent/#all-configuration-options/) ` add_filter('ubk_cookie_consent/javascript_options', static function ($cookieConsentOptions) { $cookieConsentOptions['cookie_domain'] = '.example.com'; return $cookieConsentOptions; }); ` Disable autorun ` add_filter('ubk_cookie_consent/autorun', static function ($autorun) { return false; }); // call ubk_show_cookie_consent() when needed if (function_exists('ubk_show_cookie_consent')) { ubk_show_cookie_consent(); } ` --- # Actions Add custom/service Javascripts to page and control them by cookie consent ` add_action('ubk_cookie_consent/add_app_scripts', static function () { if (wp_get_environment_type() === 'production') { ?> ` tag to `
` and prefix attributes with `data-` - data-iframe-cookie-needed - cookie category needed for iframe - data-iframe-placeholder-url - url to placeholder image which will be used instead for iframe content Example: `
` == Installation == 1. Go to settings -> Cookie consent 2. Fill all texts and cookies table for defined languages (Polylang plugin is supported) 3. Set Google Tag Manager ID under *Settings* tab == Changelog == 1.0.0 GTM consent mode supported