[theme-reviewers] wp_enqueue_script

Andrew Nacin wp at andrewnacin.com
Wed Sep 15 15:35:13 UTC 2010

On Wed, Sep 15, 2010 at 11:31 AM, Austin Matzko <austin at pressedcode.com>wrote:

> On Wed, Sep 15, 2010 at 10:21 AM, Chip Bennett <chip at chipbennett.net>
> wrote:
> > But, what we really need is what the official best-practice suggestion
> will
> > be, for the purposes of the Guidelines. We need to ensure that all
> reviewers
> > will be making consistent suggestions with respect to wp_enqueue_script()
> > within functions.php.
> It's really a range depending on what you're trying to do: before init
> is too early; default wp_head is too late.
> I would strongly recommend that front-end scripts not be enqueued in
> the admin, so that means checking that is_admin() returns false if a
> front-end conditional "tag" like is_singular() isn't already used.

The point is, before init is too early, but on init means it'll show up in
the admin.
Hence template_redirect is a good option, as that is enough to ensure it
gets enqueued for the frontend, with no is_admin() check required.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20100915/39eeb57b/attachment.htm>

More information about the theme-reviewers mailing list