Forked from ontiuk/woocommerce-select2-selectwoo-remove
Last active
November 2, 2020 15:51
-
-
Save zubaer-ahammed/77d825e94167ce09ed03c1d1df64a9c4 to your computer and use it in GitHub Desktop.
Woocommerce Remove Select2 / SelectWoo
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
// Add to your theme's functions.php file. De-queues Select2 styles & scripts. Useful to keep Boostrap form control formatting | |
/** | |
* Remove Woocommerce Select2 - Pre WC 3.2.1-ish | |
*/ | |
function woo_dequeue_select2() { | |
if ( class_exists( 'woocommerce' ) ) { | |
wp_dequeue_style( 'select2' ); | |
wp_deregister_style( 'select2' ); | |
wp_dequeue_script( 'select2'); | |
wp_deregister_script('select2'); | |
} | |
} | |
//Frontend | |
add_action( 'wp_enqueue_scripts', 'woo_dequeue_select2', 100 ); | |
//Admin | |
add_action( 'admin_enqueue_scripts', 'woo_dequeue_select2', 100 ); | |
/** | |
* Remove Woocommerce Select2 - Woocommerce 3.2.1+ | |
*/ | |
function woo_dequeue_select2() { | |
if ( class_exists( 'woocommerce' ) ) { | |
wp_dequeue_style( 'select2' ); | |
wp_deregister_style( 'select2' ); | |
wp_dequeue_script( 'selectWoo'); | |
wp_deregister_script('selectWoo'); | |
} | |
} | |
//Frontend | |
add_action( 'wp_enqueue_scripts', 'woo_dequeue_select2', 100 ); | |
//Backend | |
add_action( 'admin_enqueue_scripts', 'woo_dequeue_select2', 100 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment