Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save theperfectwill/85b8cb37ed9355249e52c8e763d4f34b to your computer and use it in GitHub Desktop.
Save theperfectwill/85b8cb37ed9355249e52c8e763d4f34b to your computer and use it in GitHub Desktop.
Dequeue Styles and Scripts In WordPress
<?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