Debugging cron tasks in WordPress

How do I debug a cron task performed by internal cron functions ? My cron task does not work, and I believe that some functions are not yet declared when the cron hook occurs.

Would it be nice if I could store errors in some kind of log file? Any ideas? Thank.

I used the Core Control plugin to find out if everything is ok. The function my_task_hook and hooked too, the "runtime" is changing ... so something else should be wrong.

+3
source share
1 answer

I found the wp-cron dashboard plugin http://wordpress.org/extend/plugins/wp-cron-dashboard/ is very useful. Using it, I was able to see which tasks cron performed or not.

I also found that the docs about cron functions are not very clear. When setting up the wp cron task, make sure that you add the function as an action using add_action, only then can you run wp_schedule_event in the task.

Good luck

+3
source

Source: https://habr.com/ru/post/1779569/


All Articles