Site logo

Archived topic

Removing The Internet Explorer conditional comment

3 replies · Started by Patrick on April 25, 2020

Viewing posts 1–4 of 4

Hi,
could you please advise how to remove the Internet Explorer conditional comment from the HTML...

<!--[if lte IE 11]> <script type='text/javascript' src='https://MYWEBSITE.com/wp-content/themes/generatepress/js/classList.min.js?ver=2.4.2'></script> <![endif]-->

I'm building a site using a child theme of GeneratePress and would like to remove the reference to the parent theme. Although, I believe that this may affect upgrading Generatepress, its no problem for this project.
Thanks,
Patrick

Hi there,

Are you wanting to remove the conditional or the entire classList.min.js file?

Just the conditional please.
Thanks

Hmm, we use the core wp_script_add_data() function to add the condition, but they don't have a way to remove it.

The only way is somewhat hacky, and might not be super update-proof if we ever change the file/handle.

add_action( 'wp_enqueue_scripts', function() {
    wp_dequeue_script( 'generate-classlist' );
    wp_enqueue_script( 'custom-generate-classlist', get_template_directory_uri() . "/js/classList{$suffix}.js", array(), GENERATE_VERSION, true );
}, 100 );
This archived topic is closed to new replies.