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

WordPress Trac noreply at wordpress.org
Tue Nov 26 12:49:40 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):

 > One issue there is that you're calling wp_schedule_event() (which calls
 wp_get_schedules() on plugins_loaded, so you are triggering a translation
 call on plugins_loaded. If you do it on init instead, I don't see any
 issue, be it when loading normally or when actually executing wp-cron.

 Understood - it was just an example of what a lot of plugins are doing,
 including scheduling a task via `register_activation_hook` so they don't
 need to do a `wp_next_scheduled` check every request. That's no longer
 possible with a translatable `display` value.

 If any plugin calls `wp_schedule_event` before `init`, it should cause all
 plugins that are registering a custom schedule to generate the warning.

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


More information about the wp-trac mailing list