Late-enqueued scripts in the footer
-
There’s a setting for where in the HTML to place the head.js loader, but if a script is enqueued after that point then it’s ommitted. It would be extremely helpful if any scripts enqueued after the main head() could be loaded at the end.
For example, consider a Google Maps script that’s only needed on pages about specific events. You don’t know until the page itself that the map is going to be necessary, so you don’t load the script on every page; instead you enqueue it as you reach that point.
WordPress’ enqueue_script function has a setting for “script should be loaded in the footer”. It would be useful for head.js to respect that, and write in the footer any scripts that couldn’t or shouldn’t be written in the header.
- The topic ‘Late-enqueued scripts in the footer’ is closed to new replies.