[Plugin: JavaScript to Footer] plugin moves styles as well as scripts to footer
-
I was confused when I saw this happening – why would the plugin move styles as well as scripts to the footer?
Then I realized that I’m hooking my function that runs both
wp_enqueue_style
andwp_enqueue_script
to the actionwp_enqueue_scripts
. When I change the hook toinit
, everything seems to work OK.However, as far as I can tell, hooking to
wp_enqueue_scripts
– despite the name – is best practice for styles as well as scripts. The codex recommends it, and Automattic’s _s starter theme does it that way too.Do you know a way to get around this? Or what the actual downsides there are to hooking to
init
?https://www.ads-software.com/extend/plugins/footer-javascript/
- The topic ‘[Plugin: JavaScript to Footer] plugin moves styles as well as scripts to footer’ is closed to new replies.