Adding tags like defer or async to enqueued javascript

With ‚wp_enqueue_script‚ we can add external javascript to a page and with ‚script_loader_tag‚ we can change the output, which is very well described here: https://wordpress.stackexchange.com/questions/38319/how-to-add-defer-defer-tag-in-plugin-javascripts/38335#38335

With that it gets easy to add a defer and / or an async tag or any other desired attribute.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.