um-woocommerce Function _load_textdomain_just_in_time
-
Hello Ultimate Member staff. How do deal with this? Will there be a fix soon?
Getting the following error:
Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the um-woocommerce 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.—-
The notice indicates that the translation loading for the
um-woocommercedomain is being initiated earlier than recommended in the WordPress loading process. With the release of WordPress 6.7, it’s advised that translations be loaded at theinitaction or later to ensure proper functionality. I found discussion on this on Github and elsewhere.Understanding the Issue:
When a plugin or theme attempts to load translation files before the
inithook, WordPress triggers this notice to highlight the premature action. This is often due to theload_plugin_textdomainorload_theme_textdomainfunctions being called too early in the execution sequence.Seems a possible code fix to the plugin would fix the error:
add_action(‘init’, function() {
load_plugin_textdomain(‘um-woocommerce’, false, dirname(plugin_basename(FILE)) . ‘/languages’);
});But this would break the cardinal rule of not modify a 3rd party plugin code.
So I guess it would be better to modify the functions.php file instead with:
add_filter(‘doing_it_wrong_trigger_error’, function($trigger, $message, $type) {
if (strpos($message, ‘_load_textdomain_just_in_time’) !== false) {
return false;
}
return $trigger;
}, 10, 3);
The topic ‘um-woocommerce Function _load_textdomain_just_in_time’ is closed to new replies.