Auto Clear and Auto Cache Specific Pages Only?


I have installed the MU-Plugins ( to not clear and auto cache the website because it was causing the website to come to a crawl, randomly. With the MU-Plugins installed, I only manually clear and auto cache the website as needed and the website is now consistently zippy.

I want to be able to automatically clear a few pages related to events that are time-sensitive, like events that are past. Ideally, I could use WP Control to clear and auto cache a few select pages at midnight, daily. Is that possible and what would be the command for that in WP Control? Or, perhaps I am going about this the wrong way?

Please advise, and thank you.

@iaiawebmaster The best option would be to use the Comet Cache API. There’s a list of the various API methods here: Clearing the Cache Dynamically

1 Like

Thank you, but those methods do not allow for schedules. (They’re based on a trigger like saving a page or post to start them.)

Maybe I am going about this the wrong way? While Comet Cache is really great, the default settings caused our website to come to crawl with its auto-cache and clear routines. I disabled those with the MU-Plugins and now our website is fast.

I only want a few pages to be routinely cleared and auto-cached—pages like the home page, happenings, and a page where we have a weather widget. All the other pages can be cleared manually when needed.

Here are the pages I want to auto clear and auto cache:

  1. Home (daily at midnight):
  2. Happenings: (daily at midnight):
  3. Portal (daily, at 2 hour intervals):

Thanks for your assistance and feedback!

This article that I linked to above explains how you can create an MU-Plugin that can trigger an API call upon visiting a specific URL. You can use that to make API calls to clear the Home page, and any other pages. You can then schedule that URL to be called via a Cron job on your web server.

Or, an even easier way to achieve the above, would be to use the WP Crontrol plugin and create custom WP Cron events that run the necessary API calls to clear the pages you want to clear at the intervals of your choosing.

Here’s a screenshot showing how you could clear all of those URLs daily at midnight UTC. In your case, you could just create three separate cron events, each scheduled as you’d like.

1 Like

I should also add that your URL in the API call to comet_cache::clearUrl() can utilize the Watered-Down Regex Syntax if necessary.

1 Like

I’ve updated the Clearing the Cache Dynamically KB Article to include a section on Scheduling Custom Clear Cache Events, as described above.

1 Like

Dear @raamdev,

This is a really fantastic set of options that you came up with. I have been eager to try them out on our development server. I really appreciate all of the work and correspondence.

I wonder, would it be possible to schedule a followup command to auto-clear the selected pages after the clearing schedule? (I am just thinking about the First-Come Slow-Load Issue for the people who visit the page after the WP Control clearing routinel.)

Many, many thanks,


1 Like

I assume you’re referring to auto-caching, not auto-clearing, after a clear command. That’s currently not possible, as the Auto-Cache Engine only works by reading an XML Sitemap at the moment. However we have a GitHub related feature request open that you might want to leave a comment on to show your vote for this feature:

1 Like

Yes, @raamdev, that’s what I meant to say—auto-cache command. Thanks again for all your assistance and I look forward to the new feature in the future.