Title: Caching CSS in a PHP file
Last modified: March 9, 2018

---

# Caching CSS in a PHP file

 *  Resolved [khaotic](https://wordpress.org/support/users/khaotic/)
 * (@khaotic)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/caching-css-in-a-php-file/)
 * Hello,
    Is there any posibility to cache a CSS located in PHP file? I have a 
   theme with the custom_css.php file which I applied my code, but Autooptimize 
   didn’t cache it. It’s really important to me, because there are over 2k lines
   so caching will improve the speed of the page I guess.
 * hope help you soon

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

 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/caching-css-in-a-php-file/#post-10056380)
 * AO cannot optimize code in .php files I’m afraid, but you could migrate your 
   code from your theme’s “custom css” to WordPress core’s “additional CSS” (Appearance-
   > Customize -> Additional CSS”, in which case WordPress will add the CSS inline
   where AO can pick it up.
 * hope this helps,
    frank
 *  Thread Starter [khaotic](https://wordpress.org/support/users/khaotic/)
 * (@khaotic)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/caching-css-in-a-php-file/#post-10057156)
 * Thanks, now it works great 🙂
 *  Plugin Author [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * (@futtta)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/caching-css-in-a-php-file/#post-10057162)
 * you’re welcome @khatoic, feel free to [leave a raving review here](https://wordpress.org/support/plugin/autoptimize/reviews/#new-post)!
   😉
 * enjoy your friday!
    frank

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

The topic ‘Caching CSS in a PHP file’ 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: [Frank Goossens](https://wordpress.org/support/users/futtta/)
 * Last activity: [8 years, 2 months ago](https://wordpress.org/support/topic/caching-css-in-a-php-file/#post-10057162)
 * Status: resolved