Last active
February 13, 2022 02:59
-
-
Save brunomarks7/0341b264247a17c8007ed89e6b0d4e08 to your computer and use it in GitHub Desktop.
Debug registered names of scripts on wordpress theme queue and dequeue
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
<?php | |
# insert above functions for debug | |
function debug_wp_scripts_on_queue() { | |
global $wp_scripts; | |
echo "<h2>Enqueued JS Scripts</h2><ul>"; | |
foreach( $wp_scripts->queue as $handle ) : | |
echo "<li>" . $handle . "</li>"; | |
endforeach; | |
echo "</ul>"; | |
} | |
add_action( 'wp_print_scripts', 'debug_wp_scripts_on_queue' ); | |
# this function dequeue scripts by page, insert into page template or combinated with conditional tags | |
add_action( 'wp_enqueue_scripts', function(){ | |
wp_dequeue_script('woo-coupon-url'); | |
wp_dequeue_script('jquery-bind-first'); | |
//wp_dequeue_script('astra-single-product-ajax-cart'); | |
//wp_dequeue_script('astra-addon-js'); | |
wp_dequeue_script('mailchimp-woocommerce'); | |
//wp_dequeue_script('wc-cart-fragments'); | |
//wp_dequeue_script('woocommerce'); | |
wp_dequeue_script('astra-flexibility'); | |
wp_dequeue_script('astra-theme-js'); | |
wp_dequeue_script('wc-add-to-cart'); | |
//wp_dequeue_script('pys'); | |
}, 100 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment