Hooks not responding (transients or cache interferring?)
-
Hi,
I’m trying to avoid script injection if user is logged in. It’s working propperly the first time I enter the website (logged out) and click on “Accept cookies”: scripts are injected after clicking the button.
I use these hooks for remove scripts when a user log in, but if I log in the scripts remain active. To make the scripts dissapear I have to save GRPD cookie compliance settings again, but it only works once, if I log out scripts don’t inject again.
Thanks in advance
add_action(‘moove_gdpr_third_party_header_assets’,’moove_gdpr_third_party_header_assets’);
function moove_gdpr_third_party_header_assets( $scripts ) {
if (is_user_logged_in()) {
$scripts = ‘<script>console.log(“scripts-head-anulados”);</script>’;
}
return $scripts;
}
add_action(‘moove_gdpr_third_party_body_assets’,’moove_gdpr_third_party_body_assets’);
function moove_gdpr_third_party_body_assets( $scripts ) {
if (is_user_logged_in()) {
$scripts = ‘<script>console.log(“scripts-body-anulados”);</script>’;
}
return $scripts;
}
add_action(‘moove_gdpr_third_party_footer_assets’,’moove_gdpr_third_party_footer_assets’);
function moove_gdpr_third_party_footer_assets( $scripts ) {
if (is_user_logged_in()) {
$scripts = ‘<script>console.log(“scripts-footer-anulados”);</script>’;
}
return $scripts;
}
- The topic ‘Hooks not responding (transients or cache interferring?)’ is closed to new replies.