Add async or defer to script tags in WordPress

In this article, we will intercept the generation of script tags, and alter the output in an attempt to improve web site performance. The filter code will add either a defer or async attribute to the script tag.