mirror of
https://github.com/szepeviktor/wordpress-website-lifecycle.git
synced 2025-08-17 18:11:08 +08:00
fix metronet
This commit is contained in:
parent
478319d4b1
commit
4bac23ded8
1 changed files with 24 additions and 2 deletions
|
@ -6,12 +6,34 @@
|
|||
*/
|
||||
|
||||
add_filter('option_metronet_tag_manager', static function ($value) {
|
||||
if (is_admin()) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
$defaults = [
|
||||
'code' => '',
|
||||
'code_head' => '',
|
||||
'variables' => [
|
||||
0 => ['name' => 'title', 'value' => '%post_title%'],
|
||||
1 => ['name' => 'author', 'value' => '%author_name%'],
|
||||
2 => ['name' => 'wordcount', 'value' => '%wordcount%'],
|
||||
3 => ['name' => 'logged_in', 'value' => '%logged_in%'],
|
||||
4 => ['name' => 'page_id', 'value' => '%page_id%'],
|
||||
5 => ['name' => 'post_date', 'value' => '%post_date%'],
|
||||
6 => ['name' => 'post_type', 'value' => '%post_type%'],
|
||||
],
|
||||
'external_variables' => [],
|
||||
'is_post_enabled' => 'on',
|
||||
'enable_tiny_mce' => 'on',
|
||||
'enable_gutenberg' => 'on',
|
||||
];
|
||||
|
||||
// Read CookieYes cookie
|
||||
if (!isset($_COOKIE['cookieyes-consent'])) {
|
||||
return false;
|
||||
return $defaults;
|
||||
}
|
||||
|
||||
return in_array('analytics:yes', explode(',', $_COOKIE['cookieyes-consent']), true)
|
||||
? $value
|
||||
: false;
|
||||
: $defaults;
|
||||
}, 20, 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue