php - Catching error messages and states from wp cron
307
Is it possible to catch data from wp cron? ex. I set a function to run via wp cron, I want to get the following:
- Errors/Exceptions that have been thrown inside the function if there are any so I can present it to the end user
- Success/Failure status, the function returns certain values to indicate success and failure of operation, I want to get that also from the function that is running via wp cron to display the operation status
Is this even possible? if so, any help is much appreciated.
Thank You
Answer
Solution:
To debug cron in WordPress, add your function to
sanitize_comment_cookies
hookAs
wp_cron function
gets executed in this action hook. You will see errors, if any, printed when you reload your frontend page