WooCommerce 4.0更新后,WP Cron作业停止工作

问题描述

自从更新到最新的WooCommerce版本以来,我的自定义插件cron作业无法正确执行。 cron作业似乎正在运行,但是相关的动作/功能没有任何作用。在更新之前,它就像一个魅力。这是插件中的代码:

if (!function_exists('check_birthday_install')) {
    function check_birthday_install()
    {
        if (!wp_next_scheduled('check_birthday_event')) {
            wp_schedule_event(time(),'daily','check_birthday_event');
        }
    }
}
register_activation_hook(__FILE__,'check_birthday_install');

function my_deactivation()
{
    wp_clear_scheduled_hook('check_birthday_event');
}

register_deactivation_hook(__FILE__,'my_deactivation');

function check_birthday()
{
    // do something related to checking user birthday here
    error_log("working");
}

add_action('check_birthday_event','check_birthday');

我已经使用Cron Events多次测试了该事件并运行了该事件,但无济于事。是否有人熟悉WooCommerce 4.0(或WordPress 5)之后的更改

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...