Last active
February 12, 2023 08:40
-
-
Save siaeb/d0a238fc3ba4060bf4201ce582bb332d to your computer and use it in GitHub Desktop.
Revisions
-
siaeb revised this gist
Jun 23, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -45,4 +45,4 @@ function woo_scripts_cleaner() { } } add_action( 'wp_enqueue_scripts', 'woo_scripts_cleaner', 99 ); -
siaeb created this gist
Jun 23, 2022 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,48 @@ function woo_scripts_cleaner() { remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) ); if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() ) { $woo_styles = [ 'woocommerce_frontend_styles', 'woocommerce-general', 'woocommerce-layout', 'woocommerce-smallscreen', 'woocommerce_fancybox_styles', 'woocommerce_chosen_styles', 'woocommerce_prettyPhoto_css', 'select2' ]; $woo_scripts = [ 'wc-add-payment-method', 'wc-lost-password', 'wc_price_slider', 'wc-single-product', 'wc-add-to-cart', 'wc-cart-fragments', 'wc-credit-card-form', 'wc-checkout', 'wc-add-to-cart-variation', 'wc-single-product', 'wc-cart', 'wc-chosen', 'woocommerce', 'prettyPhoto', 'prettyPhoto-init', 'jquery-blockui', 'jquery-placeholder', 'jquery-payment', 'jqueryui', 'fancybox', 'wcqi-js', ]; // Dequeue Styles foreach ( $woo_styles as $style ) { wp_dequeue_style( $style ); } // Dequeue scripts foreach ( $woo_scripts as $script ) { wp_dequeue_script( $script ); } } } add_action( 'wp_enqueue_scripts', 'woo_scripts_cleaner', 15 );