If you get down to business with performance optimisation, you could find yourself looking at ways to defer your scripts or even load them asynchronously.
As far as I’m aware, WordPress’ built-in functions wp_register_script()
and wp_enqueue_script()
don’t currently take arguments for defining these attributes. But, with WordPress being WordPress, there is usually a way and in this case, we just need to hook into the script_loader_tag
filter and modify the HTML directly.
Here is a snippet to get you moving;