Last active
November 19, 2018 15:55
-
-
Save Willem-Siebe/c6d798ccba249d5bf080 to your computer and use it in GitHub Desktop.
Remove CSS and/or JS for Select2 used by WooCommerce, see http://stackoverflow.com/questions/28547598/how-to-unload-select2-script-styles-loaded-by-new-woocommerce-2-3-x.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Remove CSS and/or JS for Select2 used by WooCommerce, see https://gist.github.com/Willem-Siebe/c6d798ccba249d5bf080. | |
add_action( 'wp_enqueue_scripts', 'wsis_dequeue_stylesandscripts_select2', 100 ); | |
function wsis_dequeue_stylesandscripts_select2() { | |
if ( class_exists( 'woocommerce' ) ) { | |
wp_dequeue_style( 'select2' ); | |
wp_deregister_style( 'select2' ); | |
wp_dequeue_script( 'select2'); | |
wp_deregister_script('select2'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is the working code till today with latest woo version (19/11/2018 - Woo Ver: 3.5.1)
Sometimes "Select2" dont render in first page load, giving to the user a simple text field ... so I am going to sidable it in each of my new projects.
Thanks!