Title: Auto scheduling a cache clear
Last modified: August 31, 2016

---

# Auto scheduling a cache clear

 *  Resolved [ElliottAgain](https://wordpress.org/support/users/elliottagain/)
 * (@elliottagain)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/auto-scheduling-a-cache-clear/)
 * I need to set a cron to clear the cache at a pre set time each day. I see from
   your documentation a brief overview on this functionality. Please can you provide
   more detailed instruction on how to set this up, where to add the code and what
   the url structure would look like, with some examples:
 * Auto scheduling a cache clear
    What if you want to be able to clear the cache
   every day at some certain time? Or by hitting a URL? If this is what you would
   like to do a simple script, called by cron should do the trick.
 * <?php
    include ‘wp-load.php’; wfCache::clearPageCache(); ?>
 * [https://wordpress.org/plugins/wordfence/](https://wordpress.org/plugins/wordfence/)

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

 *  [WFSupport](https://wordpress.org/support/users/wfsupport/)
 * (@wfsupport)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/auto-scheduling-a-cache-clear/#post-7024278)
 * You make that file on your web server and name it cacheclear.php or bringoutyourdeadfiles.
   php or whatever.php and then call that from cron.
 * tim
 *  Thread Starter [ElliottAgain](https://wordpress.org/support/users/elliottagain/)
 * (@elliottagain)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/auto-scheduling-a-cache-clear/#post-7024279)
 * Thank you for reply. This works great, just have to make sure the newly created
   file is added in the same location as the wp-load.php file in public_html.
 * Many thanks again.
    Elliott
 *  [AJD](https://wordpress.org/support/users/ajd/)
 * (@ajd)
 * [10 years ago](https://wordpress.org/support/topic/auto-scheduling-a-cache-clear/#post-7024586)
 * Sorry, just need a little more clarification on this, I’m not familiar on setting
   up cron.
 * To clear the cache every day at midnight?
 * Create a cron to run at midnight every day with this command: wfCache::clearPageCache();
 * OR:
 * Create a .php file in the same directory as wp-load.php and add the following
   code into the page? And then create a cron to hit that page?
 *     ```
       <?php
       include 'wp-load.php';
       wfCache::clearPageCache();
       ?>
       ```
   

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

The topic ‘Auto scheduling a cache clear’ is closed to new replies.

 * ![](https://ps.w.org/wordfence/assets/icon.svg?rev=2070865)
 * [Wordfence Security - Firewall, Malware Scan, and Login Security](https://wordpress.org/plugins/wordfence/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordfence/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordfence/)
 * [Active Topics](https://wordpress.org/support/plugin/wordfence/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordfence/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordfence/reviews/)

## Tags

 * [cache](https://wordpress.org/support/topic-tag/cache/)
 * [falcon cache](https://wordpress.org/support/topic-tag/falcon-cache/)

 * 3 replies
 * 3 participants
 * Last reply from: [AJD](https://wordpress.org/support/users/ajd/)
 * Last activity: [10 years ago](https://wordpress.org/support/topic/auto-scheduling-a-cache-clear/#post-7024586)
 * Status: resolved