I use the following function in my plugin to display all the scripts handles in my plugin options page but it display only the handles of admin scripts:

function my_detected_scripts() {
  global $wp_scripts;
  foreach( $wp_scripts->queue as $handle ) :
    echo $handle . ' <br /> ';


echo my_detected_scripts()

How can get the handles of all front-end enqueued scripts only?

Thanks in advance!

  • I've tested and retested your code. Tested it in my theme and plugin, it only prints front end scripts. Aug 7, 2014 at 16:42
  • Using the funtion above? That's incredible. By the way, it output the jquery-code too? Thnx.
    – Knott
    Aug 7, 2014 at 16:45
  • Well yes, incredible or not. Your code is not your problem, something else is. Set debug to true in wp_config.php and see if you get any errors. I would suggest to reinstall wordpress Aug 7, 2014 at 16:49

1 Answer 1


I think it's not possible to get the front-end scripts in a script called in the back-end, because the front-end scripts are all registered in scripts called only on the front-end. I think the only way would be to save a transient option including the front-end scripts on front-end page loading and get the transient option via ajax in the back-end. Maybe it will be not the best way, but I don't see other solutions. Then of course you can add all the conditions with nonces ... to save the transient only in specific conditions ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.