[wp-trac] [WordPress Trac] #43801: Need better documentation to show importance of checking for args while using wp_schedule_event and wp_next_scheduled

WordPress Trac noreply at wordpress.org
Wed Apr 18 15:47:51 UTC 2018


#43801: Need  better documentation to show importance of checking for args while
using wp_schedule_event and wp_next_scheduled
-----------------------------+-----------------------------
 Reporter:  digamberpradhan  |      Owner:  (none)
     Type:  defect (bug)     |     Status:  new
 Priority:  normal           |  Milestone:  Awaiting Review
Component:  General          |    Version:
 Severity:  normal           |   Keywords:
  Focuses:                   |
-----------------------------+-----------------------------
 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 ) );
 }
 }

 add_action('init','schedule_my_event');
 }}}


 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.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/43801>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list