Register, not enqueue
-
Not all pages might need jQuery, so it’s best to just deregister the old version and register the new version (and not enqueue).
Anything which declares jQuery as a dependency will automatically enqueue jQuery.
This way on pages where scripts don’t need jQuery won’t load it.
An example is a plugin script which does something on comments. The home page doesn’t have a comment box and won’t need it.
But by enqueuing, you are forcing it where it’s not needed.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Register, not enqueue’ is closed to new replies.