Created
August 2, 2017 10:13
-
-
Save fernandiez/aaad250e0ddc36d748a56418e9233c05 to your computer and use it in GitHub Desktop.
Dequeue CSS Styles and JavaScript Scripts in child theme
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
// Dequeue CSS Styles and JavaScript Scripts in child theme | |
// Dequeue Styles | |
function dequeue_unnecessary_styles() { | |
wp_dequeue_style( 'bootstrap-map' ); | |
wp_deregister_style( 'bootstrap-map' ); | |
} | |
add_action( 'wp_print_styles', 'dequeue_unnecessary_styles' ); | |
// Dequeue JavaScripts | |
function dequeue_unnecessary_scripts() { | |
wp_dequeue_script( 'modernizr-js' ); | |
wp_deregister_script( 'modernizr-js' ); | |
wp_dequeue_script( 'project-js' ); | |
wp_deregister_script( 'project-js' ); | |
} | |
add_action( 'wp_print_scripts', 'project_dequeue_unnecessary_scripts' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm trying to dequeue Modenizr on this site as it seems to be slowing it down quite a lot, and I don't think it's necessary, but I can't work out how to do it. I've tried deleting the contents of the JS file, and deleting the contents of the plugin.js file that calls the script, but it's still being called, so I'm obviously missing something.
It's probably a really stupid mistake I'm making as I'm pretty new to all this, but any ideas would be welcome!