php - Catching error messages and states from wp cron


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




To debug cron in WordPress, add your function tosanitize_comment_cookies hook

add_action('sanitize_comment_cookies', 'your-cron-function-name');

Aswp_cron function gets executed in this action hook. You will see errors, if any, printed when you reload your frontend page

People are also looking for solutions to the problem: When Class method same name php function


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.