Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter pooltech

    (@pooltech)

    Ok, there is a solution available and fixed by the author on Github: https://github.com/duracelltomi/gtm4wp/issues/390

    Since this hasn’t been updated in the plugin here, it requires you to move some lines of codes in the plugin file admin.php (Located in /wp-content/plugins/duracelltomi-google-tag-manager/admin).
    https://github.com/duracelltomi/gtm4wp/commit/c37df6d09f4fdb79dae5237b9cb7d07a6c55928e

    It’s strange that the author hasn’t updated the plugin here, as this is an issue reported 4 month ago, the multiple people having the same issue. So I will not mark this question as resolved.

    royalmicer

    (@royalmicer)

    I’m running WordPress 6.7.0 and I’ve started seeing the following PHP Notice in my debug log whenever your plugin loads:

    PHP Notice: Function _load_textdomain_just_in_time was called incorrectly. 
    Translation loading for the “<your-textdomain>” domain was triggered too early. 
    Translations should be loaded at the init action or later. 
    (This message was added in version 6.7.0.)  
    in /…/wp-includes/functions.php on line 6121
    

    What’s happening:
    WordPress 6.7 introduced a just-in-time translation loader that expects all calls to load a plugin’s textdomain to occur at or after the init hook. If your code calls _load_textdomain_just_in_time() (or internally triggers translation loading) on plugin-file load, WP throws this notice.

    Why it matters:

    • Early translation loading can lead to missing strings or conflicts with other plugins/themes that haven’t initialized yet.
    • It clutters debug logs, making it harder to spot real errors.

    How to fix:
    Wrap your load_plugin_textdomain() (or equivalent) call in an init callback, for example:

    add_action( 'init', function() {
        load_plugin_textdomain( '<your-textdomain>', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
    }, 5 );
    

    This ensures translations are loaded at the correct time in WordPress’s lifecycle.

    I hope this helps! Please let me know if you need any further details.

    Thanks for all your hard work on the plugin!

    Plugin Author Thomas Geiger

    (@duracelltomi)

    v1.21 was released yesterday with a fix to this error message.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘PHP Notice – Translations loaded incorrectly’ is closed to new replies.