wp_schedule_event未触发 [英] wp_schedule_event not firing

查看:180
本文介绍了wp_schedule_event未触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在主题的functions.php中安排事件,但无法将其触发.我正在使用Cron View插件,它显示了正确安排的事件,但执行时间未发生任何事情.

I'm trying to schedule an event inside a theme's functions.php but I cannot get it to "fire". I'm using the Cron View plugin and it shows the event scheduled correctly but nothing happened when is time to execute.

这是我的代码

if ( ! wp_next_scheduled( 'prefix_hourly_event' ) ) {
    wp_schedule_event( time(), 'hourly', 'prefixhourlyevent');       
}
add_action( 'prefixhourlyevent', 'prefix_do_this_hourly' );

function prefix_do_this_hourly() {                
    wp_mail('myemail@gmail.com','Cron is working', 'Cron is working: ','','');
}

推荐答案

您可以通过转到 http://www.example.com/wp-cron.php?doing_cron .在这里,您将能够看到脚本创建的任何错误,这在调试wp计划任务时非常有用.

You can manually run WordPress cron jobs by going to http://www.example.com/wp-cron.php?doing_cron. This is where you will be able to see any errors that your scripts creates, really useful when debugging wp scheduled tasks.

这篇关于wp_schedule_event未触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆