Make WordPress Core

Opened 4 years ago

Last modified 12 months ago

#43801 new enhancement

Need better documentation to show importance of checking for args while using wp_schedule_event and wp_next_scheduled

Reported by: digamberpradhan Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Cron API Keywords: good-first-bug has-patch
Focuses: docs Cc:


While the user notes https://developer.wordpress.org/reference/functions/wp_next_scheduled/#user-contributed-notes do relay the importance. I believe it is important that the documentation also be more clear about the issue.

When coded incorrectly something like

function schedule_my_event(){
if ( ! wp_next_scheduled( 'myevent' ) ) { // This will always be false
    wp_schedule_event( time(), 'daily', 'myevent', array( false ) );


It's potentially disastrous for a site. The cron value in the options would keep on increasing until the database could no longer withstand it.

So keeping that in mind I feel the documentation for both wp_next_scheduled and wp_schedule_event should highlight this point more.

Attachments (1)

43801.patch (1.7 KB) - added by ovidiul 12 months ago.
adding missing documentation text for wp_schedule_event and wp_next_scheduled functions

Download all attachments as: .zip

Change History (4)

#1 @markparnell
16 months ago

  • Component changed from General to Cron API
  • Focuses docs added

#2 @johnbillion
16 months ago

  • Keywords needs-patch good-first-bug added
  • Milestone changed from Awaiting Review to Future Release
  • Type changed from defect (bug) to enhancement

12 months ago

adding missing documentation text for wp_schedule_event and wp_next_scheduled functions

#3 @ovidiul
12 months ago

  • Keywords has-patch added; needs-patch removed
Note: See TracTickets for help on using tickets.