[theme-reviewers] wp_enqueue_script

Austin Matzko austin at pressedcode.com
Wed Sep 15 14:53:06 UTC 2010


On Wed, Sep 15, 2010 at 9:49 AM, Chip Bennett <chip at chipbennett.net> wrote:
> For the Theme in question, it's wrapped in the usual conditionals (e.g. if (
> is_singular() && get_option( 'thread_comments' ) ) ). It's just not hooked
> into anything. I'll make the suggestion to hook into wp_head().

Actually the wp_head event action hook is too late to enqueue a
script, if you want it in the header (as opposed to the footer).
That's because the enqueued scripts are printed during wp_head with
priority 1.  So a call to wp_enqueue_script in a function that's a
callback on wp_head will come too late.

A better place would be the template_redirect action hook.


More information about the theme-reviewers mailing list