Skip to content

Instantly share code, notes, and snippets.

@wtmujeebu
Created March 4, 2021 05:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wtmujeebu/b3797b2e7651bfc1f77a538d93d21aa3 to your computer and use it in GitHub Desktop.
Save wtmujeebu/b3797b2e7651bfc1f77a538d93d21aa3 to your computer and use it in GitHub Desktop.
Dequeue GDPR cookie consent script by WebToffee
<?php
function move_gdpr_script() {
if (class_exists('Cookie_Law_Info')) {
if (!is_admin()) {
wp_dequeue_script('cookie-law-info');
wp_enqueue_script('cookie-law-info', '', array('jquery'), false, true);
wp_dequeue_script('cookie-law-info-ccpa');
wp_enqueue_script('cookie-law-info-ccpa', '', array('jquery', 'cookie-law-info'), false, true);
}
}
}
add_action( 'wp_enqueue_scripts', 'move_gdpr_script', 999 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment