【发布时间】:2019-10-31 18:43:08
【问题描述】:
我手动将代码添加到子主题function.php:https://techjourney.net/automatically-flush-purge-w3tc-w3-total-cache/ 以清除“w3 总缓存”的缓存。 现在,尽管按照同一程序员的建议添加了应该停止进程的代码,但它仍在继续......
如何停止和删除该 cron?因为它甚至没有像预期的那样每天都在工作,而是从几天以来每秒都在发送垃圾邮件
这是添加 mf cron 的代码:
// Flush W3TC Cache
function tj_flush_w3tc_cache() {
$w3_plugin_totalcache->flush_all();
}
// Schedule Cron Job Event
function tj_flush_cache_event() {
if ( ! wp_next_scheduled( 'tj_flush_cache_event' ) ) {
wp_schedule_event( current_time( 'timestamp' ), 'daily', 'tj_flush_w3tc_cache' );
}
}
add_action( 'wp', 'tj_flush_cache_event' );
这是应该阻止它但不起作用的代码:
function tj_disable_auto_flush_cache() {
wp_clear_scheduled_hook('tj_flush_cache_event');
}
add_action('wp', 'tj_disable_auto_flush_cache');
【问题讨论】:
标签: php wordpress cron w3-total-cache