{"id":10267232,"date":"2018-05-10T16:52:11","date_gmt":"2018-05-10T16:52:11","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/defer-error\/"},"modified":"2018-05-10T16:52:11","modified_gmt":"2018-05-10T16:52:11","slug":"defer-error","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/defer-error\/","title":{"rendered":"Defer error"},"content":{"rendered":"<p>I have resolved my problem, but wanted to make you aware of it in case it could help your further development.<\/p>\n<p>After updating to the latest version 0.7.0, we began seeing sitewide errors in the AMP validator related to <code>defer<\/code> being added to <code>&lt;script type=&#039;text\/javascript&#039; async=&quot;async&quot; src=&#039;https:\/\/cdn.ampproject.org\/v0.js&#039;&gt;<\/code><\/p>\n<p>This was caused by code I have in functions.php to add defer to jQuery.<\/p>\n<pre><code>function add_async_attribute($tag, $handle) {\n  if ( &#039;jquery&#039; == $handle )\n    return $tag;\n    return str_replace( &#039; src&#039;, &#039; defer=&quot;defer&quot; src&#039;, $tag );\n}<\/code><\/pre>\n<p>I would think that the v2.js plugin should not qualify as having the jquery handle. The fix was to change <code>defer=&quot;defer&quot;<\/code> to <code>async=&quot;async&quot;<\/code>.<\/p>\n","protected":false},"template":"","class_list":["post-10267232","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/10267232","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/10267232\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=10267232"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}