Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Zach Schnackel

    (@zslabs)

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

    Thread Starter luke.oakes

    (@lukeoakes)

    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.

    Plugin Author Zach Schnackel

    (@zslabs)

    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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Don't enqueue jquery when not needed’ is closed to new replies.