[wp-trac] [WordPress Trac] #44937: Add _doing_it_wrong to load_plugin_textdomain

WordPress Trac noreply at wordpress.org
Wed Oct 2 11:58:45 UTC 2024


#44937: Add _doing_it_wrong to load_plugin_textdomain
--------------------------------------+-------------------------
 Reporter:  garrett-eclipse           |       Owner:  swissspidy
     Type:  enhancement               |      Status:  closed
 Priority:  normal                    |   Milestone:  6.7
Component:  I18N                      |     Version:  4.7
 Severity:  normal                    |  Resolution:  fixed
 Keywords:  has-patch needs-dev-note  |     Focuses:
--------------------------------------+-------------------------

Comment (by SergeyBiryukov):

 Replying to [comment:30 swissspidy]:
 > I see how mentioning `after_setup_theme` is confusing to users though.
 Maybe it should mention `init` instead?

 Thanks! That's an option too. I would slightly adjust the wording in that
 case:
 {{{
 Translations should be loaded at the `init` action or later, to ensure
 that the current user is already set up.
 }}}

 > (Soft) deprecate `load_plugin_textdomain()` and
 `load_theme_textdomain()` and rely solely on the just-in-time loading and
 `WP_Textdomain_Registry`.
 >
 > This would avoid any `_doing_it_wrong` messages for plugins still using
 `load_plugin_textdomain()`, which seems to be the most common case and
 affects even very big plugins. So it would drastically reduce the noise.
 >
 > It would still trigger a `_doing_it_wrong` message if accidentally
 causing the just-in-time loading too early.

 I like that approach :)

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


More information about the wp-trac mailing list