Title: loadCSS in head?
Last modified: January 23, 2019

---

# loadCSS in head?

 *  Resolved [Ramanan](https://wordpress.org/support/users/superpoincare/)
 * (@superpoincare)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/loadcss-in-head/)
 * Hi Frank,
 * As per loadCSS, the javascript can be loaded in head. All browsers except IE 
   versions below 9 won’t block render. So the author recommends this.
 *     ```
       <link rel="preload" href="path/to/mystylesheet.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
       <noscript><link rel="stylesheet" href="path/to/mystylesheet.css"></noscript>
       <script>
       /*! loadCSS rel=preload polyfill. [c]2017 Filament Group, Inc. MIT License */
       (function(){ ... }());
       </script>
       ```
   
 * Is there a filter which will move the javascript in the head?

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

 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/loadcss-in-head/#post-11122443)
 * Afraid not, but I’ll add a filter in AO 2.5.
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/loadcss-in-head/#post-11122480)
 * done on github; [https://github.com/futtta/autoptimize/commit/3c7944c061f9d9844baea1fdb8c1bb70b1d2faf9](https://github.com/futtta/autoptimize/commit/3c7944c061f9d9844baea1fdb8c1bb70b1d2faf9)
 * feel free to [download 2.5](https://github.com/futtta/autoptimize/archive/beta.zip)
   to test/ use 🙂
 *  Thread Starter [Ramanan](https://wordpress.org/support/users/superpoincare/)
 * (@superpoincare)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/loadcss-in-head/#post-11122510)
 * Oh great. Will try!
 *  Thread Starter [Ramanan](https://wordpress.org/support/users/superpoincare/)
 * (@superpoincare)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/loadcss-in-head/#post-11122571)
 * Tried
 *     ```
       add_filter( 'autoptimize_css_preload_polyfill_injectat', function() {
       	return array( '</head>', 'before' );
       } );
       ```
   
 * and works!
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/loadcss-in-head/#post-11122847)
 * perfect 🙂
 * there’s quite a number of other changes (fixes, improvements and new functionality)
   in there, so feel free to have a look around and report any issue you might find!
 *  Thread Starter [Ramanan](https://wordpress.org/support/users/superpoincare/)
 * (@superpoincare)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/loadcss-in-head/#post-11123279)
 * Yeah sure, will try to find.
 *  Thread Starter [Ramanan](https://wordpress.org/support/users/superpoincare/)
 * (@superpoincare)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/loadcss-in-head/#post-11126339)
 * Frank,
 * Have observed this. In stable release itself. If one chooses to not concatenate
   css files, AO adds the query args from wp_enqueue_style even though the minified
   filename with the hash itself acts as a cache buster.
 * Have you kept it for some reason?
 * Sometimes themes just update without styles changing (to add other features).
   So the only difference in the style.css is the version in the header. The minified
   output won’t change. So having a query string unnecessarily busts cache.
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [7 years, 4 months ago](https://wordpress.org/support/topic/loadcss-in-head/#post-11126516)
 * > Have you kept it for some reason?
 * yes, because else there’s an overlap with “remove query strings” on the “extra”
   tab. now people who want to keep querystrings can, those who don’t simply have
   to tick that “extra”-option 🙂

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

The topic ‘loadCSS in head?’ 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/)

 * 8 replies
 * 2 participants
 * Last reply from: [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * Last activity: [7 years, 4 months ago](https://wordpress.org/support/topic/loadcss-in-head/#post-11126516)
 * Status: resolved