-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
Description of the bug
After updating to WordPress 6.7.0, a notice appears indicating that translation loading for the inpsyde-google-tag-manager text domain is triggered too early. The function load_plugin_textdomain() is currently called within the plugins_loaded hook, but WordPress now enforces that translations should be loaded at the init hook or later.
This results in the following notice:
Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the inpsyde-google-tag-manager 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.
To resolve this issue, the load_plugin_textdomain() call should be moved to the init hook.
Reproduction instructions
- Install and activate the inpsyde-google-tag-manager plugin on WordPress 6.7.0 or later.
- Enable WP_DEBUG mode in wp-config.php:
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', true);
- Load any admin or frontend page.
- Observe the PHP notice in the debug log or on-screen.
Expected behavior
The plugin should load translations without triggering any notices or warnings.
Environment info
- Package version: Latest plugin(2.2.0) and WordPress version(6.7.2)
- Browser: Chrome
- OS: MacOS
Relevant log output
Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the inpsyde-google-tag-manager 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.Additional context
Solution:
- Move translation loading to the
inithook and remove it fromplugins_loaded.
add_action('init', function () {
load_plugin_textdomain('inpsyde-google-tag-manager');
});
Code of Conduct
- I agree to follow this project's Code of Conduct
Reactions are currently unavailable