[wp-docs] wp_enqueue_script ... "can lead to problems"

Sergey Biryukov sergeybiryukov.ru at gmail.com
Wed Feb 1 14:43:36 UTC 2012


On Mon, Jan 30, 2012 at 2:32 PM, Ghodmode <ghodmode at ghodmode.com> wrote:
> The ticket has already been fixed and there isn't any other supporting
> reason not to use wp_enqueue_script.  Also, the function is called
> directly in current themes, including twentyeleven.
>
> This statement should be removed, shouldn't it?

No. Calling wp_enqueue_script() directly would produce a
_doing_it_wrong() notice with WP_DEBUG on (that was the consensus in
the ticket) and still cause i18n problems (all JavaScript strings will
be displayed in English).

Twenty Ten and Twenty Eleven only call it directly in header.php,
which is after WP_Scripts is properly initialized and therefore is
safe.


More information about the wp-docs mailing list