Created
December 14, 2018 22:14
-
-
Save rameyrobo/2e8270f155729c843abdeccc0390ae93 to your computer and use it in GitHub Desktop.
Find handle for your Wordpress plugins
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
# 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