WPIntell

Source evidence

Don't enqueue jquery when not needed

WP jQuery Plus · support · 2016-04-20T13:26:00+00:00

complaintsentiment
mediumseverity
0.92relevance
3replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

7 / 37 rows with source links

18.9% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

30 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
luke.oakes unresolved
I appreciate what this website does in loading jquery from a cdn. However, I have many pages on my site that don’t require jquery, but it seems the plugin enqueues jquery regardless. Is it possible to avoid enqueuing jquery when it’s not needed please? https://wordpress.org/plugins/wp-jquery-plus/ Hi, That sounds like more of a general question around dequeuing scripts , correct? Kind of. Say another plugin/theme enqueues a script that depends on jquery, then jquery is enqueued, but if nothing is enqueued that depends on jquery, then jquery isn’t enqueued. However, when your plugin is active, jquery is enqueued on every page regardless of whether it’s needed or not. I can see both sides to that. Sure, it’s probably a waste to load jQuery if you’re not using it, but the mere fact that you have this plugin installed means that it’s assumed to be used “somewhere”, a vast majority of WordPress plugins depend on it anyway, it’s part of the WordPress ecosystem, and also if you’ve loaded it on a page already, the caching of that script from these CDNs would make it a non-issue on subsequent pages anyway. Seeing how individuals using this plugin currently would assume it would be enqueued, I’d need more of a reason to change this than what I find to be a very specific scenario that hasn’t come up since this has been released.

Comments

3 shown
Zach Schnackel 2016-04-27T18:46:00+00:00

Hi, That sounds like more of a general question around dequeuing scripts , correct?

luke.oakes 2016-04-28T10:09:00+00:00

Kind of. Say another plugin/theme enqueues a script that depends on jquery, then jquery is enqueued, but if nothing is enqueued that depends on jquery, then jquery isn’t enqueued. However, when your plugin is active, jquery is enqueued on every page regardless of whether it’s needed or not.

Zach Schnackel 2016-04-28T14:15:00+00:00

I can see both sides to that. Sure, it’s probably a waste to load jQuery if you’re not using it, but the mere fact that you have this plugin installed means that it’s assumed to be used “somewhere”, a vast majority of WordPress plugins depend on it anyway, it’s part of the WordPress ecosystem, and also if you’ve loaded it on a page already, the caching of that script from these CDNs would make it a non-issue on subsequent pages anyway. Seeing how individuals using this plugin currently would assume it would be enqueued, I’d need more of a reason to change this than what I find to be a very specific scenario that hasn’t come up since this has been released.