【问题标题】:PHP delete a cronjob on wordpressPHP在wordpress上删除一个cronjob
【发布时间】: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


    【解决方案1】:

    我在我的function.php中使用了这个

    update_option('cron', '');
    

    现在它只在列表中显示正确的 crons(我正在使用插件来控制我的 wordpress 上的 crons)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-02-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-17
      • 2015-10-08
      相关资源
      最近更新 更多