Created
February 29, 2016 05:53
-
-
Save mrkpatchaa/d5166277abecee045273 to your computer and use it in GitHub Desktop.
Dequeue Styles and Scripts In WordPress
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 | |
/** From http://www.paulund.co.uk/dequeue-styles-scripts-wordpress */ | |
/** | |
* Dequeue JavaScript or Stylesheet. | |
*/ | |
function dequeue_script() | |
{ | |
// Run the dequeue script with the handle of the JavaScript file | |
wp_dequeue_script( $handle ); | |
// Run the dequeue style with the handle of the CSS file | |
wp_dequeue_style( $handle ); | |
} | |
add_action( 'wp_enqueue_scripts', 'dequeue_style', 100 ); | |
/** | |
* Discover The Handles | |
*/ | |
function discover_scripts() | |
{ | |
// Registered styles | |
var_dump(wp_styles()->registered); | |
// Queued styles | |
var_dump(wp_styles()->queue); | |
// Registered scripts | |
var_dump(wp_scripts()->registered); | |
// Queued scripts | |
var_dump(wp_scripts()->queue); | |
} | |
add_action( 'wp_enqueue_scripts', 'discover_scripts', 100 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment