Title: Code to clear cache
Last modified: August 22, 2016

---

# Code to clear cache

 *  Resolved [boybawang](https://wordpress.org/support/users/boybawang/)
 * (@boybawang)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/code-to-clear-cache/)
 * Hello –
    I run automated backups and would like to be able to kick off a cron
   job that clears the cache before the backup. What is the PHP code I’d need to
   use to clear the cache? Thanks, Pete
 * [https://wordpress.org/plugins/quick-cache/](https://wordpress.org/plugins/quick-cache/)

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

 *  Plugin Author [Raam Dev](https://wordpress.org/support/users/raamdev/)
 * (@raamdev)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/code-to-clear-cache/#post-5261014)
 * Hi Pete,
 * Please see [Clearing the Cache Dynamically](https://github.com/websharks/quick-cache/wiki/Clearing-the-Cache-Dynamically).
 * You should be able to use `$GLOBALS['quick_cache']->clear_cache();`. You’ll need
   to make sure you include `wp-load.php` in your PHP script to load WordPress before
   calling Quick Cache:
 * `require_once("/path/to/wordpress/wp-load.php");`
 *  Thread Starter [boybawang](https://wordpress.org/support/users/boybawang/)
 * (@boybawang)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/code-to-clear-cache/#post-5261015)
 * Perfect. Thank you!

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

The topic ‘Code to clear cache’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/quick-cache_efefef.svg)
 * [Quick Cache (Speed Without Compromise)](https://wordpress.org/plugins/quick-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/quick-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/quick-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/quick-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/quick-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/quick-cache/reviews/)

## Tags

 * [cron](https://wordpress.org/support/topic-tag/cron/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 2 replies
 * 2 participants
 * Last reply from: [boybawang](https://wordpress.org/support/users/boybawang/)
 * Last activity: [11 years, 9 months ago](https://wordpress.org/support/topic/code-to-clear-cache/#post-5261015)
 * Status: resolved