[wp-hackers] [ wp-hackers ] wp _ enqueue _ script() not working while in the Loop

TobiasBg wp-hackers at tobias.baethge.com
Wed Dec 16 21:58:31 UTC 2009


Hi,

> The wp_enqueue_script action happens just after wp_head, so unless your loop
> happens before then(which would be very odd)  , it won't function.

If you are refering to wp_enqueue_scripts (did you miss the s for a typo?), I can't really see that.

"wp_enqueue_scripts" is attached to wp_head, correct.
But it is nothing more than a wrapper for another action hook (with the same name). Basically to give developers a more logical place to use for enqueuing then pure wp_head.
By default there's nothing attached to it (I couldn't grep anything).

The actual printing of the scripts is done by "wp_print_head_scripts" and "wp_print_footer_scripts" (as far as I understand the code), which are attached to "wp_head" and "wp_footer" respectively.

And while I'm in the Loop, I clearly enqueue the script before wp_footer. So I still don't get it, why it won't work... :-(

Regards,
Tobias





More information about the wp-hackers mailing list