Skip to content

Instantly share code, notes, and snippets.

@robneu
Last active November 25, 2022 09:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robneu/8291089 to your computer and use it in GitHub Desktop.
Save robneu/8291089 to your computer and use it in GitHub Desktop.
Display a list of all currently enqueued script handles. Useful for manual minification when using Better WordPress Minify and other similar plugins.
<?php
/**
* Output a list of all enqueued script handles.
*
* @author FAT Media, LLC
* @global $wp_scripts
* @todo Change 'prefix' to your theme or plugin prefix.
*/
function prefix_print_script_handles() {
global $wp_scripts;
// Loop through and display all script handles.
foreach( $wp_scripts->queue as $handle ) {
echo $handle . ' | ';
}
}
add_action( 'wp_print_scripts', 'prefix_print_script_handles' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment