Title: Defer error
Last modified: May 10, 2018

---

# Defer error

 *  Resolved [Clicknathan](https://wordpress.org/support/users/clicknathan/)
 * (@clicknathan)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/defer-error/)
 * I have resolved my problem, but wanted to make you aware of it in case it could
   help your further development.
 * After updating to the latest version 0.7.0, we began seeing sitewide errors in
   the AMP validator related to `defer` being added to `<script type='text/javascript'
   async="async" src='https://cdn.ampproject.org/v0.js'>`
 * This was caused by code I have in functions.php to add defer to jQuery.
 *     ```
       function add_async_attribute($tag, $handle) {
         if ( 'jquery' == $handle )
           return $tag;
           return str_replace( ' src', ' defer="defer" src', $tag );
       }
       ```
   
 * I would think that the v2.js plugin should not qualify as having the jquery handle.
   The fix was to change `defer="defer"` to `async="async"`.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [Clicknathan](https://wordpress.org/support/users/clicknathan/)
 * (@clicknathan)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/defer-error/#post-10267237)
 * …marking resolved…
 *  [espacemusculation](https://wordpress.org/support/users/espacemusculation/)
 * (@espacemusculation)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/defer-error/#post-10267598)
 * is it possible to add a “hack” to disable this function only for amp files ??
 *  Plugin Author [Weston Ruter](https://wordpress.org/support/users/westonruter/)
 * (@westonruter)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/defer-error/#post-10268431)
 * See [https://wordpress.org/support/topic/problem-with-defer/#post-10268270](https://wordpress.org/support/topic/problem-with-defer/#post-10268270)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Defer error’ is closed to new replies.

 * ![](https://ps.w.org/amp/assets/icon.svg?rev=2527602)
 * [AMP](https://wordpress.org/plugins/amp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/amp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/amp/)
 * [Active Topics](https://wordpress.org/support/plugin/amp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/amp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/amp/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [Weston Ruter](https://wordpress.org/support/users/westonruter/)
 * Last activity: [8 years, 1 month ago](https://wordpress.org/support/topic/defer-error/#post-10268431)
 * Status: resolved