Unfortunately, WP-Optimize doesn’t warm up pages after purging them during the updating/inserting of posts/pages.
So, I’ve decided to implement this feature on my own. Using the code below, I call the run_cache_preload method of the WP-Optimize class to preload purged pages in the background.
Hope this helps.
/*
* AUTOMATIC CACHE PRELOADER (WP-OPTIMIZE)
*/
function preload_cache_job() {
$commands = new WP_Optimize_Cache_Commands();
$commands->run_cache_preload();
}
add_action('preload_cache_event', 'preload_cache_job', 10, 3);
function preload_cache() {
wp_schedule_single_event(time() + 3, 'preload_cache_event');
}
add_action('save_post', 'preload_cache', 10, 1);
add_action('add_attachment', 'preload_cache', 10, 1);
add_action('edit_attachment', 'preload_cache', 10, 1);
add_action('delete_attachment', 'preload_cache', 10, 1);
-
This reply was modified 2 years, 4 months ago by mostafaznv.