[wp-hackers] Adding Additional Attributes in Script Tag for 3rd party JS

Otto otto at ottodestruct.com
Mon Aug 26 22:36:53 UTC 2013


On Mon, Aug 26, 2013 at 5:11 PM, Andrew Bartel <andrew.bartel at gmail.com> wrote:
> What's the best way to get those included when using the
> wp_enqueue_script() function?

There is no way to do this short of overriding the WP_Scripts class
entirely to allow for extra attributes.

Even then, it's not possible to override WP_Scripts properly because
it's explicitly declared as a new class without a check or override in
a few admin places (load-scripts, customize, etc).

So basically, print it out yourself in the relevant *_head or
*_print_scripts action. No good way to enqueue it.

-Otto


More information about the wp-hackers mailing list