[wp-trac] [WordPress Trac] #62462: Reconsider _doing_it_wrong warning when loading translations early

WordPress Trac noreply at wordpress.org
Mon Nov 25 15:24:20 UTC 2024


#62462: Reconsider _doing_it_wrong warning when loading translations early
-------------------------------+---------------------
 Reporter:  TimothyBlynJacobs  |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  6.7.2
Component:  I18N               |     Version:  6.7
 Severity:  normal             |  Resolution:
 Keywords:                     |     Focuses:
-------------------------------+---------------------

Comment (by brianhogg):

 The Events Calendar Pro causes this error with the majority of plugins
 that have a schedule.

 Something like this should cause the warning since
 `tecs_register_cron_schedule` is run before `init` yet oddly I'm not
 seeing the translation warning on my local:

 {{{#!php
 <?php
 function tecs_schedule_event() {
     var_dump( 'scheduling...' );
     wp_schedule_event( time(), 'every_40mins', 'tecs_scheduled_event' );
 }
 add_action( 'plugins_loaded', 'tecs_schedule_event' );

 function tecs_init() {
     var_dump( 'tecs_init' );
 }
 add_action( 'init', 'tecs_init' );

 function tecs_register_cron_schedule( $schedules ) {
     var_dump( 'registering schedule...' );
     $schedules['every_40mins'] = [
         'interval' => 2400,
         'display' => __( 'Every 40 minutes', 'the-events-calendar-
 shortcode' ),
     ];

     return $schedules;
 }
 add_action( 'cron_schedules', 'tecs_register_cron_schedule' );

 }}}

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


More information about the wp-trac mailing list