Title: Flush Cache With PHP Code (Api)
Last modified: May 17, 2017

---

# Flush Cache With PHP Code (Api)

 *  [elior99](https://wordpress.org/support/users/elior99/)
 * (@elior99)
 * [8 years, 12 months ago](https://wordpress.org/support/topic/flush-cache-with-php-code-api/)
 * Hey guys,
    I’m trying to flush all cache with php code.
 *     ```
       include("wp-content/plugins/w3-total-cache/w3-total-cache-api.php");
       if (function_exists('w3tc_flush_all')) {
       	w3tc_flush_all();
   
       }
       ```
   
 * This is the code but for some reason it’s not working, i tried to echo inside
   condition but no output..
    What is the reason?
 * Thanks.

The topic ‘Flush Cache With PHP Code (Api)’ 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/)

 * 0 replies
 * 1 participant
 * Last reply from: [elior99](https://wordpress.org/support/users/elior99/)
 * Last activity: [8 years, 12 months ago](https://wordpress.org/support/topic/flush-cache-with-php-code-api/)
 * Status: not resolved