After updating to WordPress 6.7, I’m receiving the following PHP notice on my website. How can I resolve this issue?
Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the blahblah domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /wp-includes/functions.php on line 6114
Translation loading for the blahblah domain.
Check your textdomain registration code and make sure the function is set to init
hook or later. By textdomain registration code I mean the load_textdomain, load_plugin_textdomain, or load_theme_textdomain functions.
For example the following code is wrong and should get fixed.
add_action('plugins_loaded', function()
{
load_plugin_textdomain('your-textdomain', false, '/path/to/your/plugin/languages/');
});
The following code is the correct one:
add_action('init', function()
{
load_plugin_textdomain('your-textdomain', false, '/path/to/your/plugin/languages/');
});
If you are using the get_plugin_data function before the WordPress init
hook, you must pass false as the third parameter or adjust your code logic to ensure it runs after the init
hook.
For more information you can check the https://make.wordpress.org/core/2024/10/21/i18n-improvements-6-7/ URL.