Skip to content

Instantly share code, notes, and snippets.

@mrkpatchaa
Created February 29, 2016 05:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mrkpatchaa/d5166277abecee045273 to your computer and use it in GitHub Desktop.
Save mrkpatchaa/d5166277abecee045273 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