hello-theme icon indicating copy to clipboard operation
hello-theme copied to clipboard

Translation loading for the hello-elementor domain was triggered too early.

Open pingram3541 opened this issue 1 year ago • 3 comments

I have scoured the theme files and cannot find what is causing this. I cannot find any mention of textdomain let alone 'domain' yet when I need to debug, my log file is full of this error.

[12-Dec-2024 23:52:59 UTC] PHP Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the hello-elementor 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 /../../../public_html/wp-includes/functions.php on line 6114

pingram3541 avatar Dec 13 '24 00:12 pingram3541

It's caused by __() functions executing prior to init.

pingram3541 avatar Dec 13 '24 22:12 pingram3541

@pingram3541 See my answer in https://github.com/elementor/hello-theme/issues/423

rami-elementor avatar Dec 15 '24 10:12 rami-elementor

Thanks @rami-elementor, interestingly, when this theme files are scanned, the only instance of "textdomain" can be found in the change log text file, yet the error persists and the domain in the error is 'hello-elementor'.

Did you happen to see the Make link above your answer in #423? It suggests that __() functions triggered before init will also result in this error.

Your plugin might be _doing_it_wrong() if you for example directly call get_plugin_data() (which attempts to load translations by default) or __() without waiting for the init hook.

I have commented out the code in WordPress core that causes this problem, yeah I know cardinal sin but they provided no way to hook or filter it out and the constant chatter in my debug log (which is needed to flush out another problem) was just too much to bare. Thanks for your help with this.

pingram3541 avatar Dec 16 '24 16:12 pingram3541