JavaScript to Footer
plugin moves styles as well as scripts to footer (1 post)

  1. Steve Taylor
    Posted 4 years ago #

    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 and wp_enqueue_script to the action wp_enqueue_scripts. When I change the hook to init, 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?


Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic