Title: JS optimization causing scripts to 404
Last modified: December 15, 2023

---

# JS optimization causing scripts to 404

 *  [Remco Tolsma](https://wordpress.org/support/users/remcotolsma/)
 * (@remcotolsma)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/js-optimization-causing-scripts-to-404/)
 * > The plugin’s javascript optimization settings are adding an & instead of a ?
   > to any scripts it’s optimizing. This is breaking the scripts and causing them
   > to 404.
   >  [https://wordpress.org/support/topic/bug-thats-breaking-scripts-defer-render-blocking-causes-scripts-to-404/](https://wordpress.org/support/topic/bug-thats-breaking-scripts-defer-render-blocking-causes-scripts-to-404/)
 * We have the same issue on SiteGround hosting plan with ID `TGdEK2FuNEVKUT09`.
   In our case it also autoscaled our cloud hosting plan with multiple 1 GB Memory
   slots:
 * > Your cloud ●●●●●●●●●●●●●●● has been scaled up automatically with 1 GB Memory
   > because you reached the resource usage threshold. The additional Memory will
   > be available on your cloud plan for 1 calendar month and will not be auto renewed
   > based on your current autoscaling settings.
   >  [noreply@siteground.com](https://wordpress.org/support/topic/js-optimization-causing-scripts-to-404/noreply@siteground.com?output_format=md)
 * The topic mentioned above is marked as resolved, but unfortunately that is not
   the case.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fjs-optimization-causing-scripts-to-404%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 *  [Reüel](https://wordpress.org/support/users/pronamic_reuel/)
 * (@pronamic_reuel)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/js-optimization-causing-scripts-to-404/#post-17280230)
 * It seems this is caused by the changes in Speed Optimizer version 7.4.5 in the
   function **`add_async_attribute( $tag, $handle, $src )`** for the “Defer Render-
   blocking JS” setting.
    - 7.4.4 → [https://plugins.trac.wordpress.org/browser/sg-cachepress/tags/7.4.4/core/Front_End_Optimization/Front_End_Optimization.php#L240](https://plugins.trac.wordpress.org/browser/sg-cachepress/tags/7.4.4/core/Front_End_Optimization/Front_End_Optimization.php#L240)
    - 7.4.5 → [https://plugins.trac.wordpress.org/browser/sg-cachepress/tags/7.4.5/core/Front_End_Optimization/Front_End_Optimization.php#L240](https://plugins.trac.wordpress.org/browser/sg-cachepress/tags/7.4.5/core/Front_End_Optimization/Front_End_Optimization.php#L240)
 * In our case, these are the values that this method receives (please note I’ve
   added some spaces in the source URL to prevent this forum to replace characters):
 *     ```wp-block-code
       $src = 'https://www.example.com/test.js?siteground-async=1 & # 0 3 8;ver=1.0.0';
   
       $tag = "<script type='text/javascript' src='https://www.example.com/test.js?siteground-async=1&ver=1.0.0' id='test-js'></script>";
       ```
   
 * The call to `remove_query_arg( 'siteground-async', $src )` then results in `https://
   www.example.com/test.js#038;ver=1.0.0` and the resulting `$tag` of the `add_async_attribute()`
   function then contains an invalid URL (resulting in an endless stream of HTTP
   404 errors):
 *     ```wp-block-code
       https://www.example.com/test.js&ver=1.0.0
       ```
   
 * Hope this will be fixed soon!
    -  This reply was modified 2 years, 5 months ago by [Reüel](https://wordpress.org/support/users/pronamic_reuel/).
    -  This reply was modified 2 years, 5 months ago by [Reüel](https://wordpress.org/support/users/pronamic_reuel/).
      Reason: Special characters got replaced
 *  [Reüel](https://wordpress.org/support/users/pronamic_reuel/)
 * (@pronamic_reuel)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/js-optimization-causing-scripts-to-404/#post-17280359)
 * SiteGround confirmed in support chat they’re on it:
 * > I can see that this has been raised already in terms of what is going on. So
   > our wordpress developers are on it and are working on a solution.
 *  Plugin Support [kuzmanstoyanov](https://wordpress.org/support/users/kuzmanstoyanov/)
 * (@kuzmanstoyanov)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/js-optimization-causing-scripts-to-404/#post-17280919)
 * Hello [@remcotolsma](https://wordpress.org/support/users/remcotolsma/) and [@pronamic_reuel](https://wordpress.org/support/users/pronamic_reuel/),
 * Thank you both for the report. 
 * Indeed, we are aware of the reported issue. 
 * According to the latest tests we performed, the issue is only present for WordPress
   6.3 sites and lower. The problem can not be replicated if WordPress is updated
   to the latest version. 
 * Our developers have been notified and they are already looking into it. A fix
   could be expected in some of the future releases of the plugin. 
 * Best Regards, 
   Kuzman Stoyanov
 *  [mediavine](https://wordpress.org/support/users/mediavine/)
 * (@mediavine)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/js-optimization-causing-scripts-to-404/#post-17286605)
 * Is there any sort of timeline on when this will be fixed? Since it’s causing 
   any optimized scripts to 404 and a fair amount of people are on WordPress version
   6.3 or below, hopefully it will be fairly soon. Thanks in advance!
    -  This reply was modified 2 years, 5 months ago by [mediavine](https://wordpress.org/support/users/mediavine/).
 *  Plugin Support [Vladimir Trandev](https://wordpress.org/support/users/vtrandev/)
 * (@vtrandev)
 * [2 years, 5 months ago](https://wordpress.org/support/topic/js-optimization-causing-scripts-to-404/#post-17286836)
 * Hello [@mediavine](https://wordpress.org/support/users/mediavine/),
 * The case has been already brought to the attention of our plugin’s developers.
   However, we can not provide an ETA.
 * Regards,
 * Vladimir
 *  [Karel-Jan Tolsma](https://wordpress.org/support/users/kjtolsma/)
 * (@kjtolsma)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/js-optimization-causing-scripts-to-404/#post-17368327)
 * [@vtrandev](https://wordpress.org/support/users/vtrandev/) Do you have already
   an ETA for this? This reported bug is already more than a month old. Would be
   great if this will be fixed.
 *  Plugin Support [Daniela Ivanova](https://wordpress.org/support/users/daniellaivanova/)
 * (@daniellaivanova)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/js-optimization-causing-scripts-to-404/#post-17368444)
 * Hello [@kjtolsma](https://wordpress.org/support/users/kjtolsma/),
 * We appreciate your patience and understanding regarding the matter. Currently,
   we do not have an exact ETA for when the fix will be ready. Should the issue 
   be resolved, it will be patched in some of the future releases of the plugin.
 * Best regards, 
   Daniela Ivanova
 *  Thread Starter [Remco Tolsma](https://wordpress.org/support/users/remcotolsma/)
 * (@remcotolsma)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/js-optimization-causing-scripts-to-404/#post-17368567)
 * [@daniellaivanova](https://wordpress.org/support/users/daniellaivanova/) It’s
   a bit annoying that you don’t have an ETA yet. This issue continues to cause 
   problems for us and possible other customers. Some websites become completely
   inaccessible due to this issue. Perhaps you do not realize this sufficiently 
   and this issue is therefore not given sufficient priority? Could you make this
   more of a priority and issue an ETA?
 *  Plugin Support [Daniela Ivanova](https://wordpress.org/support/users/daniellaivanova/)
 * (@daniellaivanova)
 * [2 years, 4 months ago](https://wordpress.org/support/topic/js-optimization-causing-scripts-to-404/#post-17369282)
 * Hello [@remcotolsma](https://wordpress.org/support/users/remcotolsma/),
 * We evaluate your feedback on the matter, I have already passed it directly to
   the plugin developers. We would make sure to keep you updated if there is something
   new on the topic.
 * Thank you in advance for your understanding on the matter!
 * Best Regards,
   Daniela Ivanova
 *  Thread Starter [Remco Tolsma](https://wordpress.org/support/users/remcotolsma/)
 * (@remcotolsma)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/js-optimization-causing-scripts-to-404/#post-17510861)
 * Have there been any developments for this issue?
 *  Plugin Support [Daniela Ivanova](https://wordpress.org/support/users/daniellaivanova/)
 * (@daniellaivanova)
 * [2 years, 2 months ago](https://wordpress.org/support/topic/js-optimization-causing-scripts-to-404/#post-17511173)
 * I have contacted the plugin developers to check if there is anything new on the
   topic. They confirmed that currently, there are no updates on the matter however
   they will make sure to review it as soon as possible.
   Best Regards,Daniela Ivanova

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

The topic ‘JS optimization causing scripts to 404’ is closed to new replies.

 * ![](https://ps.w.org/sg-cachepress/assets/icon-256x256.gif?rev=2971889)
 * [Speed Optimizer - The All-In-One Performance-Boosting Plugin](https://wordpress.org/plugins/sg-cachepress/)
 * [Support Threads](https://wordpress.org/support/plugin/sg-cachepress/)
 * [Active Topics](https://wordpress.org/support/plugin/sg-cachepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/sg-cachepress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/sg-cachepress/reviews/)

 * 11 replies
 * 7 participants
 * Last reply from: [Daniela Ivanova](https://wordpress.org/support/users/daniellaivanova/)
 * Last activity: [2 years, 2 months ago](https://wordpress.org/support/topic/js-optimization-causing-scripts-to-404/#post-17511173)
 * Status: not resolved