Snippi
A super awesome snippet tool.
- 1.
/* SHOW HANDLES FOR JS AND CSS */ - 2.
/* http://wpengineer.com/2308/debug-enqueued-scripts-and-styles-in-wordpress/ */ - 3.
/* http://wordpress.stackexchange.com/questions/54064/how-do-i-get-the-handle-for-all-enqueued-scripts?atw=1 */ - 4.
function wpa54064_inspect_scripts() { - 5.
if ( current_user_can( 'administrator' ) ) { - 6.
global $wp_scripts, $wp_styles; - 7.
echo 'Names for enqueued scripts<br />'; - 8.
foreach( $wp_scripts->queue as $handle ) : - 9.
echo $handle . '<br />'; - 10.
endforeach; - 11.
echo '<br />Names for enqueued styles<br />'; - 12.
foreach( $wp_styles->queue as $handle ) : - 13.
echo $handle . '<br />'; - 14.
endforeach; - 15.
} - 16.
} - 17.
add_action( 'wp_footer', 'wpa54064_inspect_scripts' );