Where Did That JS/CSS Come From?

If you run a WordPress site, chances are that you use plugins. If you use plugins, chances are that some of those plugins add their JavaScript or CSS files to your pages. And if there’s lots of JS/CSS on your pages, chances are that your site isn’t as fast as it could be, and that you should do something about it. And to do that, you first need to find out what files are being added and by whom. Which you can do by installing this little plugin I just happen to have with me : wherefrom.zip

This plugin will display a list of all JavaScript and CSS files used on the current page in the page footer. It will also show where the function that added the script or style was called from, displaying the file name and line number. Note that it will only detect files added via the wp_enqueue_* family of functions. If a plugin or theme outputs some JS/CSS directly, it won’t be included in the log.

Plugin Info

Warning: This plugin modifies WP core files! Use at your own risk.


The more technically inclined readers might now be wondering – why do you need a plugin when you can just open up the HTML and see all the JS and CSS files clear as day? Or, if that’s too inconvenient, why not use Firebug? The answer is that while source inspection and Firebug will both reveal what files were loaded, neither will tell you why.

In most cases the reason why the file is there will be obvious from the context. For example, you may recognize it as part of your theme, or a vital component of an active plugin. But sometimes there’ll be the odd script or style sheet that you’re absolutely sure shouldn’t be loaded on that page, and that’s where this plugin will come in handy. In a way, it is a debugging tool.

In my case, it was jquery.js that, for some inexplicable reason, was being loaded on every page of my blog. I couldn’t figure out what could possibly be using it, and I didn’t like the idea of checking every one of my 30+ active plugins by hand, so I wrote this plugin.

Related posts :

2 Responses to “Where Did That JS/CSS Come From?”

  1. DavidM says:

    What a novel idea for a plugin. I’ve been taking a look at getting all the code for my blog better arranged for quicker performance and I’ve realized more and more that it’s just a huge undertaking. But it looks like this plugin will make it a whole lot easier. I’ll take a look into this one.

  2. […] gzip and minify CSS, automatically combine @import’ed files.CSS CompressorYUI CompressorWhere did that CSS/JS come from?Remove unused JavaScriptThere was this one JS file that didn’t seem to actually do anything. […]

Leave a Reply