Title: Prevent W3 overwrite advanced-cache.php?
Last modified: July 12, 2018

---

# Prevent W3 overwrite advanced-cache.php?

 *  [longnha](https://wordpress.org/support/users/longnha/)
 * (@longnha)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/prevent-w3-overwrite-advanced-cache-php/)
 * Hi,
 * I need to add custom content to advanced-cache.php file, but after awhile the
   content got removed, what left is content added by W3 cache so I guess it’s the
   plugin doing.
 * How can I prevent that?
 * Thank you.

Viewing 1 replies (of 1 total)

 *  Plugin Contributor [gidomanders](https://wordpress.org/support/users/gidomanders/)
 * (@gidomanders)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/prevent-w3-overwrite-advanced-cache-php/#post-10490051)
 * We indeed replace the file to be sure the file is correct. We do that when you
   click save settings.
 * After the replacement, an action is called, “w3tc_environment_fix_on_wpadmin_request”.
   You could use that action to add your custom code to the file. that should solve
   your issue.

Viewing 1 replies (of 1 total)

The topic ‘Prevent W3 overwrite advanced-cache.php?’ is closed to new replies.

 * ![](https://ps.w.org/w3-total-cache/assets/icon-256x256.png?rev=1041806)
 * [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/w3-total-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/w3-total-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/w3-total-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/w3-total-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/w3-total-cache/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [gidomanders](https://wordpress.org/support/users/gidomanders/)
 * Last activity: [7 years, 11 months ago](https://wordpress.org/support/topic/prevent-w3-overwrite-advanced-cache-php/#post-10490051)
 * Status: not resolved