Title: Before-autoptimize hook?
Last modified: November 13, 2017

---

# Before-autoptimize hook?

 *  Resolved [erandelax](https://wordpress.org/support/users/erandelax/)
 * (@erandelax)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/before-autoptimize-hook/)
 * It there any way I can hook right before autoptimize begins processing header/
   before it starts processing every CSS file? I want to either replace 3rd party
   plugin CSS link (it bypasses enqueue_style) with my one in header buffer, or 
   pre-process the file content before minifying in order to get rid of all [@import](https://wordpress.org/support/users/import/)
   statements inside.
 * Short story: there is a plugin “amoForms for WordPress” which is heavily built
   upon CSS @import-s; client would hardly decline to use it, and devs ‘re barely
   going to change anything. [@imports](https://wordpress.org/support/users/imports/)
   are loaded bypassing WordPress & Autoptimize. It [@imports](https://wordpress.org/support/users/imports/)
   4 google fonts and a bunch of unminified CSS files this way which makes PageSpeed
   Insights a little bit unhappy…

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

 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/before-autoptimize-hook/#post-9677834)
 * you could pass (part of) the imported URL’s to the comma-separated “removables”-
   list using the `autoptimize_filter_css_removables`-filter?
 *  Thread Starter [erandelax](https://wordpress.org/support/users/erandelax/)
 * (@erandelax)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/before-autoptimize-hook/#post-9678071)
 * Yup, killed all @imports-indexing files via removables filter and then properly
   added all imports via enqueue.
 * Thx for help 🙂
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/before-autoptimize-hook/#post-9678345)
 * happy my filters are useful 🙂

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

The topic ‘Before-autoptimize hook?’ 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: [8 years, 7 months ago](https://wordpress.org/support/topic/before-autoptimize-hook/#post-9678345)
 * Status: resolved