Support » Fixing WordPress » Debugging cron tasks

  • How could I debug cron task run by internal cron functions? My cron task is not firing and I suppose some functions are not declared yet when cron hook takes place.

    It would be great if I can store the errors into some log file? Any ideas? Thanks.

    I used Core Control plugin to see if everything is all right. The my_task_hook and hooked function too, the “due time” is changing…so something else must be wrong.

Viewing 1 replies (of 1 total)
  • I am using the functions category_exists and post_exists which are declared for “wp-admin” only. This was the problem.

    I found out the easiest way to debug cron in WordPress is add your function to this hook: add_action( 'sanitize_comment_cookies', 'your_cron_function' ); because wp_cron function is also executed in this action hook. You will see errors outputted (if there are any) after doing this when you reload your front-end page.

Viewing 1 replies (of 1 total)
  • The topic ‘Debugging cron tasks’ is closed to new replies.