[wp-trac] [WordPress Trac] #13158: Cron : some events may not be scheduled

WordPress Trac noreply at wordpress.org
Fri Jun 23 07:36:56 UTC 2017


#13158: Cron : some events may not be scheduled
--------------------------+-----------------------------
 Reporter:  arena         |       Owner:  westi
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Future Release
Component:  Cron API      |     Version:  3.0
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+-----------------------------

Comment (by danielhuesken):

 Littel bit better solution as this from @vickybiswas because we don't need
 the getting of alloptions.

 {{{#!php
 <?php
 add_filter( 'pre_option_cron',
         function( $value, $option ) {
                 global $wpdb;

                 $row = $wpdb->get_row( $wpdb->prepare( "SELECT
 option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $option
 ) );
                 if ( is_object( $row ) ) {
                         $value = \maybe_unserialize( $row->option_value );
                 }

                 return $value;
         },
         10,
         2
 );
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/13158#comment:18>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list