With the release of WordPress 6.7 on November 12, 2024 the way translations are loaded was changed. This update aims to prevent potential issues caused by loading translations too early, such as before WordPress identifies the current user and their locale.In those cases WordPress might attempt to load translations in the wrong locale.
To address this, WordPress now issues a _doing_it_wrong
message when translations are loaded prematurely. As plugins and themes update to accommodate this change, you may encounter one or more notices like the following:
Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the {PLUGIN_DOMAIN} 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
Mitigation
If you see these notices on a production site, here are a few steps you can take to prevent them from disrupting your site:
1. Hide Notices on Production Sites
Set
to WP_DEBUG_DISPLAY
false
in your wp-config.php
file to hide these notices without affecting your website’s functionality:
define( 'WP_DEBUG_DISPLAY', false );
2. Suppress Notices in Logs
If your logs are getting cluttered with these notices, you can use the doing_it_wrong_trigger_error
filter to suppress them:
add_filter( 'doing_it_wrong_trigger_error', '__return_false' );
The best way to get this to work across the entire website is using a Must-Use plugin with this code snippet. Mind that as soon as your theme and all installed plugins have this situation fixed you should remove this snippet to be able to monitor your website for other potential problems.
3. Stay Up to Date
Regularly check for plugin and theme updates, as developers will likely release fixes to align with WordPress 6.7’s new translation loading approach.
We’ll keep this post updated as more information becomes available, so check back for any new developments on this change.