Listing registered scripts

Back story : We have a number of wordpress web sites experiencing issues when viewed on some IE8 browsers. The errors include the page loading but not being displayed (either a blank screen is displayed or the previous page isn’t cleared), we think it’s down to IE8 and Javascript but want to test that by deregistering each script until 1) it works or 2) we run out of scripts to deregister.

So to the questron : is their an API call that will list the handle of every front end registered script?

Read More

I have a back-up of the site’s including themes and plugings so I could grep them but I may well miss something and, being lazy, I was hoping I could get wordpress to generate the list for me.

Related posts

1 comment

  1. There’s a global variable called $wp_scripts which is an instance of the WP_Scripts class. It doesn’t have a public API for looking at registered or enqueued scripts, but you can look inside the object and see what’s going on.

    You can see all the registered scripts with:

    global $wp_scripts;
    var_dump( $wp_scripts->registered );
    

    To see the enqueued scripts:

    global $wp_scripts;
    var_dump( $wp_scripts->queue );
    

    You’ll want to run this after all your plugins & theme have had a chance to register their scripts. Maybe as part of a wp_footer handler.

    Bear in mind, of course, these are implementation details & not a real API. They could change at any moment in the future. But if you’re just debugging for now, you’re probably ok.

Comments are closed.