Title: Autoptimize and Async JavaScript
Last modified: June 13, 2018

---

# Autoptimize and Async JavaScript

 *  Resolved [ElephantDude](https://wordpress.org/support/users/elephantdude/)
 * (@elephantdude)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/autoptimize-and-async-javascript/)
 * The defer flag on the autoptimized js file is being stripped out by the async
   javascript plugin.
 * Also the Async JavaScript plugin does not recognize the Autoptimize beta as being
   installed or activated when you view the status report in the dashboard.
    -  This topic was modified 7 years, 11 months ago by [ElephantDude](https://wordpress.org/support/users/elephantdude/).
      Reason: Added second issue

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

 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/autoptimize-and-async-javascript/#post-10395708)
 * how could I have missed that?? I’ll fix in asyncJS and get back to you on that
   🙂
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/autoptimize-and-async-javascript/#post-10395876)
 * ok, so for the most serious issue, could you open wp-content/async-javascript/
   asyncjsFrontendClass.php and on line 150 (i.e. in the `aj_autoptimize_defer` 
   function) change;
 * `return '';`
 * into:
 * `return $defer;`
 * that should ensure the flag is left as is when AsyncJS is not configured to interfere.
 * frank
 *  Thread Starter [ElephantDude](https://wordpress.org/support/users/elephantdude/)
 * (@elephantdude)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/autoptimize-and-async-javascript/#post-10397107)
 * Brilliant with that code change it works as expected now. Thank you
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/autoptimize-and-async-javascript/#post-10397204)
 * OK, I’ll push out an update later today (or tomorrow if I would fall asleep 😉).
 * frank

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

The topic ‘Autoptimize and Async JavaScript’ is closed to new replies.

 * ![](https://ps.w.org/autoptimize/assets/icon-256X256.png?rev=2211608)
 * [Autoptimize](https://wordpress.org/plugins/autoptimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/autoptimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/autoptimize/)
 * [Active Topics](https://wordpress.org/support/plugin/autoptimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/autoptimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/autoptimize/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * Last activity: [7 years, 11 months ago](https://wordpress.org/support/topic/autoptimize-and-async-javascript/#post-10397204)
 * Status: resolved