• Resolved Jacob N. Breetvelt

    (@opajaap)


    This plugin generates these errors:

    Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the disable-gutenberg 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.)

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Jeff Starr

    (@specialk)

    Hi Jacob, glad to help.

    I am not seeing any errors on 6.7 beta with translations enabled.

    Can you provide steps to repeat the error, maybe there is some step I am missing.

    Thread Starter Jacob N. Breetvelt

    (@opajaap)

    Install query monitor and set a non-us-english language in the wp settings

    Plugin Author Jeff Starr

    (@specialk)

    Thanks I see the error in Query Monitor plugin.

    Though, I am not sure what to do with this, as the error says:

    “Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the query-monitor 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.”

    But the plugin is loading at “init” hook. Here is the code from the main plugin file:

    add_action('init', array($this, 'load_i18n'));

    ..where load_i18n is the function that loads the translations (via load_plugin_textdomain). So the plugin is calling using the prescribed hook, not sure what else to do here..?

    • This reply was modified 2 weeks, 6 days ago by Jeff Starr.
    Thread Starter Jacob N. Breetvelt

    (@opajaap)

    I had a similar issue with one of my plugins, and discovered the following:

    In 7.6 you do no longer need to load the textdomain explicitly, your add_action() will be ignored.

    The textdomain is automatically loaded when an i18n function like __() is called, so you need to make sure you do not use it before the init hook. Look for instance if you do it somewhere during plugins_loaded or so.

    To my opinion this is rather anoying, and forced me to use a complicated construction to change the name of a wp menu item (gallery rather than album) if the user prefers the gallery wording in my photo plugin.

    But: it worked(!)

    Plugin Author Jeff Starr

    (@specialk)

    Thanks for the explanation. I have read about the changes but cannot find anywhere in the plugin where any __() type function is called before the init hook. I went thru the list of WP hooks from start thru init. For each hook I searched the plugin and could not find anything __() happening before init. In fact none of the pre-init hooks are used at all.

    Thread Starter Jacob N. Breetvelt

    (@opajaap)

    disable-gutenberg.php

    Line 40:
    if (!class_exists(‘DisableGutenberg’)) { is before init

    Line 82:
    if (!defined(‘DISABLE_GUTENBERG_NAME’)) define(‘DISABLE_GUTENBERG_NAME’, __(‘Disable Gutenberg’, ‘disable-gutenberg’));

    if you change it into:
    if (!defined(‘DISABLE_GUTENBERG_NAME’)) define(‘DISABLE_GUTENBERG_NAME’, ‘Disable Gutenberg’);

    its fixed

    Plugin Author Jeff Starr

    (@specialk)

    Thank you for your help, Jacob. Just applied the fix to latest version, 3.2.2, now available.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.