You can completely disable Borlabs Cookie for specific URLs with the code below.
Paste the code into your own plugin or into the functions.php of your child theme.
Then add the paths where Borlabs cookie should be disabled to the $urlList
array.
add_action('after_setup_theme', function () {
// Add the URLs where Borlabs Cookie should not be loaded
$urlList = [
'/pathA/',
'/pathB/onlySubPath/',
];
if (!class_exists('\Borlabs\Cookie\Container\ApplicationContainer')) {
return;
}
$shouldRemoveAction = false;
foreach ($urlList as $url) {
if (strpos($_SERVER['REQUEST_URI'], $url) !== false) {
$shouldRemoveAction = true;
break;
}
}
if (!$shouldRemoveAction) {
return;
}
$container = \Borlabs\Cookie\Container\ApplicationContainer::get();
remove_action('init', [$container->get(\Borlabs\Cookie\System\WordPressFrontendDriver\WordPressFrontendInit::class), 'register']);
});