Skip to content

Instantly share code, notes, and snippets.

@rameyrobo
Created December 14, 2018 22:14
Show Gist options
  • Save rameyrobo/2e8270f155729c843abdeccc0390ae93 to your computer and use it in GitHub Desktop.
Save rameyrobo/2e8270f155729c843abdeccc0390ae93 to your computer and use it in GitHub Desktop.
Find handle for your Wordpress plugins
# Finding handle for your plugins
function display_script_handles() {
global $wp_scripts;
if(current_user_can('manage_options')){ # Only load when user is admin
foreach( $wp_scripts->queue as $handle ) :
$obj = $wp_scripts->registered [$handle];
echo $filename = $obj->src;
echo ' : <b>Handle for this script is:</b> <span style="color:green"> '.$handle.'</span><br/><br/>';
endforeach;
}
}
add_action( 'wp_print_scripts', 'display_script_handles' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment