WP Cron fail to update the next_schedule

I wrote a plugin that uses WP-Cron to fetch periodically json data from another server. Everything works flawlessly in m

I wrote a plugin that uses WP-Cron to fetch periodically json data from another server. Everything works flawlessly in my localhost. However, when I uploaded the whole WP site on an online server for testing, the whole WP-Cron ecosystem seems to fail.

None of any of the wp-cron jobs ever running - including that from my plugin and core jobs like "wp_privacy_delete_old_export_files".

Cron Jobs have been scheduled, as shown by the output of _get_cron_array() ... but none of the executable functions related to them will ever run.

After digging and debugging, I just found out that all those cron jobs are scheduled as next run for a time in the past, and that their next-scheduled time will never get updated to a future time.

Has anyone ever encounter a similar issue? What can be the possible issues for this?

Updates to include information from the comments:

I run "manually" the executable function and I get no errors - the function goes through and completes its tasks with no issues.

I know that no cron jobs are running at all, because I log errors and expect to see those logs in my debug.log. I even modified other cron jobs, even core ones like the "wp_privacy_delete_old_export_files", in order to test if those are running, and I get the same result.

All future scheduled-times for all cron jobs are set for a time in the past, and they never get updated.

The exact same code runs on my localhost and I can see the scheduled time to be updated every so, after refreshing.

Finally, accessing the /wp-cron.php also fails on the online server, while it causes all the scheduled cron jobs to run on my localhost. I guess, this is because on the online server, all jobs are scheduled for a time in the past that will never happen again in the future.

It looks like all those jobs just got scheduled on the first ever run, and never re-scheduled ...

I wrote a plugin that uses WP-Cron to fetch periodically json data from another server. Everything works flawlessly in my localhost. However, when I uploaded the whole WP site on an online server for testing, the whole WP-Cron ecosystem seems to fail.

None of any of the wp-cron jobs ever running - including that from my plugin and core jobs like "wp_privacy_delete_old_export_files".

Cron Jobs have been scheduled, as shown by the output of _get_cron_array() ... but none of the executable functions related to them will ever run.

After digging and debugging, I just found out that all those cron jobs are scheduled as next run for a time in the past, and that their next-scheduled time will never get updated to a future time.

Has anyone ever encounter a similar issue? What can be the possible issues for this?

Updates to include information from the comments:

I run "manually" the executable function and I get no errors - the function goes through and completes its tasks with no issues.

I know that no cron jobs are running at all, because I log errors and expect to see those logs in my debug.log. I even modified other cron jobs, even core ones like the "wp_privacy_delete_old_export_files", in order to test if those are running, and I get the same result.

All future scheduled-times for all cron jobs are set for a time in the past, and they never get updated.

The exact same code runs on my localhost and I can see the scheduled time to be updated every so, after refreshing.

Finally, accessing the /wp-cron.php also fails on the online server, while it causes all the scheduled cron jobs to run on my localhost. I guess, this is because on the online server, all jobs are scheduled for a time in the past that will never happen again in the future.

It looks like all those jobs just got scheduled on the first ever run, and never re-scheduled ...

Share Improve this question edited Jun 15, 2020 at 8:21 CommunityBot 1 asked Feb 4, 2020 at 17:59 FFrewinFFrewin 2481 silver badge13 bronze badges 5
  • WP Cron jobs only run when there are actively visitors on your site. Have you checked to see whether anyone is visiting? – WebElaine Commented Feb 4, 2020 at 18:17
  • How are you testing that these cron jobs get run? Are you sure they didn't run and get replaced by identical ones? Have you tried manually running cron jobs using WP CLI and seeing what happens? Are you sure that your cron jobs don't trigger fatal errors? – Tom J Nowell Commented Feb 4, 2020 at 18:38
  • @TomJNowell: I run "manually" the executable function and get no errors - it goes through with no issues. I know no cron jobs are running, because I log errors and expect to see those logs in my debug.log. I edited other cron jobs in order to test like the "wp_privacy_delete_old_export_files" and get the same result. As said, those schedules are set for a time in the past, and they never get updated. The exact same code runs on my localhost and I can see the scheduled time to be updated every so. So, I am trying to find out what can be causing this on the online server. – FFrewin Commented Feb 4, 2020 at 20:05
  • what happens if you manually visit the wp cron PHP file? – Tom J Nowell Commented Feb 4, 2020 at 20:09
  • @TomJNowell. No cron job function is executed on the online server. - Cron functions run as expected on localhost (by going to /wp-cron.ph) – FFrewin Commented Feb 4, 2020 at 20:29
Add a comment  | 

1 Answer 1

Reset to default -1

Some hosts (Especially shared servers) don't allow Cron Jobs as it can 'supposedly' slow their servers down.

I'd send them a ticket to ask.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744777037a4593104.html

相关推荐

  • WP Cron fail to update the next_schedule

    I wrote a plugin that uses WP-Cron to fetch periodically json data from another server. Everything works flawlessly in m

    9小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信