Hide Cookiebar/button when logged in
-
Hello. It seems that the cookie bar and button is being shown even when logged in.
There is no option in the plugin, to disable the cookies when logged in.
It could easily be implemented, by only enqueuing the javascript, when the user is logged in.
For now, i will try to see if i can remove it with a filter, but please consider implementing this out of the box, as no logged in user is interrested in seing AND wasting pageviews by watching their own cookie consent box.
For anyone who experience this problem, here’s a solution (add this to your functions.php):
PHP 7.4+
add_action('wp_enqueue_scripts',fn () => ( is_user_logged_in() || is_login() ) && wp_deregister_script('cookie-law-info') );
PHP 7.3
add_action('wp_enqueue_scripts',function () {
if ( is_user_logged_in() || is_login() ) {
wp_deregister_script('cookie-law-info');
}
});
The topic ‘Hide Cookiebar/button when logged in’ is closed to new replies.