Make WordPress Core

Opened 7 months ago

#49961 new enhancement

Expose the reason for failures that occur within WP-Cron functions

Reported by: johnbillion Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.1
Component: Cron API Keywords: 2nd-opinion
Focuses: Cc:


Since WordPress 5.1, the various WP-Cron related functions (wp_schedule_event() etc) now return meaningful return values, but this still doesn't expose the underlying reason for failure.

My WP Crontrol plugin regularly gets support requests from users who are managing cron events but getting a generic error message. It would be useful if core exposed the underlying problem so that anything that calls wp_schedule_event(), wp_unschedule_event() etc can provide a meaningful error message to the end user.

I see two potential approaches:

  1. Add an optional $wp_error parameter to these functions, similar to wp_update_post(), wp_set_comment_status() etc, and return a meaningful error when one occurs.
  2. Trigger an action containing the error details, similar to http_api_debug, which can be hooked into before calling the cron functions.

Change History (0)

Note: See TracTickets for help on using tickets.