-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WordPress 6.7 Compatibility - Translations loading too early #7102
Comments
Hello @vlaskiz thanks for creating the issue. We've been trying to replicate the issue but we were not able to. Could you provide us steps or environment that's needed in order to move forward? If you're not sure about that, it'd be great if you could share with us access to your website. |
@piotrbak I'm able to reproduce the issue with WP 6.7 locally |
@remyperona Any particular steps? 🤔 CC @wp-media/qa-team |
Hello, It's a PHP notice, so you would need to check if you can see those. Can be easily detected with Query Monitor. But you are right, looking at it, on some websites it generates the notice among a few other plugins, and on some it does not (with same other plugins present, that do not generate the notice either). Either way, you are hooking translations into plugins_loaded hook, while the notice recommends 'init' or later. |
I looked into what was triggering the warning, there is 3 files to update to prevent it. And we should also update the hook on which we load the translations like said above. I can create a quick PR for this change |
Yes, let's do it since it'll be flooding the support team. We'll need to have a way to reproduce it for the QA team tests though. |
In core, the check is against |
how to solve this problem ?? if anyone tell me how to solved . |
Wait for a release. In the meanwhile, be sure to have WP_DEBUG_LOG = false or use a filter to temporarily suppress doing-it-wrong notices.
Temporary but effective. |
define('WP_DEBUG', false); Then don't forget to restart your server and purge the cache if you use some! |
Could someone please help with a test case to check locally, or provide any helpful steps? I did check using Query Monitor, but no notices were shown. |
add_filter( 'doing_it_wrong_trigger_error', '__return_false' ); use this bro . |
thank you so much bro...👍 It works ... |
I am unsure into which file the following code should be inserted: add_filter( 'doing_it_wrong_trigger_error', '__return_false' ); Should it ne inserted into the functions.php file? Please advise. |
@supertrooper2 Create the mu-plugins folder into wp-content if it does not exist. Then create a <?php
/**
* Plugin Name: Disable Doing It Wrong Notice (Load Textdomain)
* Description: Disables the "Doing it wrong" notice that appears when a textdomain is loaded just in time.
*/
add_filter( 'doing_it_wrong_trigger_error', function ( $doing_it_wrong, $function_name ) {
if ( '_load_textdomain_just_in_time' === $function_name ) {
return false;
}
return $doing_it_wrong;
}, 10, 2 ); |
Hi Mirco
The mu-plugins folder does exist. I am not a coding expert.
Could you please send me the disable-doing-it-wrong-notice.php file?
Thanks in advance
…On Wed, Dec 25, 2024 at 10:25 AM Mirco Babini ***@***.***> wrote:
Create the mu-plugins folder into wp-content if not exists. Then create a
disable-doing-it-wrong-notice.php into it and paste this.
—
Reply to this email directly, view it on GitHub
<#7102 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APNJ4MLRS4MCJWKPDJZAUFT2HJ2Z7AVCNFSM6AAAAABRWHX5TCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNRRG42DOOBUGM>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Hi Mirco, I managed to create the disable-doing-it-wrong-notice.php file and it works perfectly. Many thanks for the great support. |
I added the file and haven't seen it do anything yet |
Describe the bug
"Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the rocket 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. (This message was added in version 6.7.0.)"
As per the notice on WP 6.7.0, translations are being loaded too early and should be moved to another (init or later) hook.
The text was updated successfully, but these errors were encountered: