Debug.log PHP Notice: Function _load_textdomain_just_in_time was called incorrectly

The following notice is bloating the debug.log. It occurred with the last two versions: v250214 and v250419 (current)

[21-Apr-2025 17:11:39 UTC] PHP Notice:  Function _load_textdomain_just_in_time was called <strong>incorrectly</strong>. Translation loading for the <code>s2member</code> 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 <code>init</code> action or later. Please see <a href="https://developer.wordpress.org/advanced-administration/debug/debug-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 6.7.0.) in /home/sites/example.com/public/wp-includes/functions.php on line 6121

Yeah noticed it too. Though I think this only happens on php 8.3 or newer.

1 Like

One more reason to stay on December’s version? :grimacing:

No that surely is on any version. It happens with php 8.3 or newer (or even only 8.4?). Query monitor spits out 5-6 plugins on my website with the same problem. It’s about translations called too early

1 Like

Yes, I have this too. php8.3, wordpress 6.8, s2Member 250424

This is the cause (and guidance on a fix):


Thanks for reporting that! I’ll look into it.

:slight_smile:

I changed the hook from plugins_loaded to init for the translations, but it wasn’t enough…

I found there’s also _x used when setting some translatable defaults in syscon.inc.php… I’m looking at how to set those defaults at init.

:slight_smile:

It took me a bit to get this right, but I think it’s ready now!

Could you give it a try before I add it to the release? You’d just need to use the updated files from the attached zip:

fix notice translation too early v250509.zip (16.0 KB)

s2member/src/includes/hooks.inc.php
s2member/src/includes/syscon.inc.php

s2member-pro/src/includes/syscon.inc.php

Once you’ve tested it, please let me know if everything works fine and the notices stop in debug.log, or if you notice any issues.

I look forward to your update! :pray:

:slight_smile:

clavaque That fixed it. Fantastic!

I also ran successful transactions through Stripe and PayPal Express, and the the debug.log was still empty.

The debug.log was filling up, right until the moment those three patched files were replaced.

1 Like

That’s great! Thanks for the update, TJ!

Did anyone else try it? How did it go for you?

:slight_smile: