Skip to content

Instantly share code, notes, and snippets.

@wtmujeebu
Created May 28, 2021 04:31
Show Gist options
  • Save wtmujeebu/a1405d99b8fe8a97c08e2f9d9f4799a7 to your computer and use it in GitHub Desktop.
Save wtmujeebu/a1405d99b8fe8a97c08e2f9d9f4799a7 to your computer and use it in GitHub Desktop.
Add href to links - CookieYes GDPR Cookie Consent
<?php
add_action('wp_footer', 'wt_cli_add_href_to_links');
function wt_cli_add_href_to_links() {
if (class_exists('Cookie_Law_Info')) {
?>
<script>
jQuery(function($) {
wt_cli_links = $('#cookie-law-info-bar a, #cliSettingsPopup a');
wt_cli_links.each(function() {
if($(this).attr('href') === undefined) {
$(this).attr('href', '#');
}
});
});
</script>
<?php
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment