Many wordpress theme, plugin, and widget developers seem to think that the only way to use jquery on the page is to include their own copy. On some pages of the site I’m developing, there are as many as six different places where I see various different copies of jquery included. This is ridiculous. It increases loading time, and is totally redundant.
Is there any easy way, either through a plugin or a bit of my own coding, to force only one copy of jquery to be included on each page? There’s already a jquery.js
in the /wp-includes/js/jquery/
directory, which should suffice for any plugin that needs it. How can I automatically remove all of the other references to it on the page?
There is no blanket solution to this.
If developer has a clue – he will reuse bundled jQuery or re-register it to other copy (commonly done to load jQuery from Google’s CDN).
Otherwise there are a lot of [insane] ways to add jQuery and there is no way to handle them all without global output buffering or tweaking hooks/plugins individually.
Overall it is often better plugins from good developers than waste time on tweaking poorly coded plugins. But if you already stuck with bunch of poor plugins – you are in for some manual cleanup. 🙁