Title: Autoptimize does not aggregate registerred-only scripts
Last modified: July 18, 2024

---

# Autoptimize does not aggregate registerred-only scripts

 *  Resolved [kschlager](https://wordpress.org/support/users/kschlager/)
 * (@kschlager)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/autoptimize-does-not-aggregate-registerred-only-scripts/)
 * Depending on a script that is only registerred and not enqued, does not work 
   with Autoptimize’s aggregate function.
 *     ```wp-block-code
       wp_register_script('script-a', '/script-a.js'), array());wp_enqueue_script('script-b', '/script-a.js'), array('jquery', 'script-a'));
       ```
   
 * In the example above script-a is missing when Autoptimize is active with aggregate(
   autoptimize_js_aggregate). Disabling Autoptimize or switching to defer only (
   autoptimize_js_defer_not_aggregate). Fixes the issue.
 * I don’t know which version introduced this error. We are currently using version
   3.1.11.

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

 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/autoptimize-does-not-aggregate-registerred-only-scripts/#post-17899396)
 * afraid Autoptimize does not *know* about WordPress enqueuying, as it “looks” 
   at the output HTML long after the enqueuing was done. AO then loosk at settings
   and specifically exclusions to optimizes the page accordingly.
 * so the question becomes what is causing script-a.js to disappear. do you have
   a test-site where you could leave things broken for me to inspect the HTML?
 *  Thread Starter [kschlager](https://wordpress.org/support/users/kschlager/)
 * (@kschlager)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/autoptimize-does-not-aggregate-registerred-only-scripts/#post-17900716)
 * Thank you for your quick response.
 * I overlooked, that in our case script-b is enqueued via wp_enqueue_script() but
   the output (filter ‘script_loader_tag’) is modified to be type=”module”. Modules
   are not aggregated nor deferred. So the loading order is not right.
   We will get
   around this on our side.
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/autoptimize-does-not-aggregate-registerred-only-scripts/#post-17900725)
 * > Modules are not aggregated nor deferred.
 * indeed 🙂
 * > Thank you for your quick response.
 * you’re welcome, feel free to [leave a review of the plugin and support here](https://wordpress.org/support/plugin/autoptimize/reviews/#new-post)!
   🙂

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

The topic ‘Autoptimize does not aggregate registerred-only scripts’ 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/)

 * 3 replies
 * 2 participants
 * Last reply from: [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * Last activity: [1 year, 10 months ago](https://wordpress.org/support/topic/autoptimize-does-not-aggregate-registerred-only-scripts/#post-17900725)
 * Status: resolved