From 4bac23ded894a0cc9a7b2236c30f278ab45a177e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Viktor=20Sz=C3=A9pe?= Date: Wed, 28 Aug 2024 13:29:01 +0000 Subject: [PATCH] fix metronet --- mu-plugins/metronet-tag-manager.php | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/mu-plugins/metronet-tag-manager.php b/mu-plugins/metronet-tag-manager.php index 204176c..b17667f 100644 --- a/mu-plugins/metronet-tag-manager.php +++ b/mu-plugins/metronet-tag-manager.php @@ -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);