• Resolved omahoung

    (@omahoung)


    Hi,

    Since updating to WordPress 6.8, I have a notice related to translation loading:

    Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the spam-destroyer 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.

    Could you please have a look?

    Thank you.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Ryan Hellyer

    (@ryanhellyer)

    Are you sure it’s coming from this plugin? It doesn’t have the load_plugin_textdomain function normally used for translating strings.

    Thread Starter omahoung

    (@omahoung)

    Hi Ryan,

    Yes, I’m sure it’s coming from this plugin. The notice appears when it’s active and goes away when deactivated. The warning started with WordPress 6.8 which likely added stricter checks on how translations are handled.

    Even though the plugin doesn’t explicitly load a text domain, it does use one in class-spam-destroyer.php, line 36:

    $this->comment_issues = array(
    'hidden-field-not-set' => esc_html__( 'Hidden input field not set', 'spam-destroyer' ),
    'wrong-timestamp' => esc_html__( 'Time not set correctly', 'spam-destroyer' ),
    'captcha-wrong' => esc_html__( 'CAPTCHA not answered correctly', 'spam-destroyer' ),
    'cookie-not-set' => esc_html__( 'Cookie not set', 'spam-destroyer' ),
    );

    Since the text domain isn’t loaded, WP throws a notice. This can be resolved either by loading the text domain, or just by removing the text domain and using plain strings.

    Just wanted to flag it. Cheers.

    Plugin Author Ryan Hellyer

    (@ryanhellyer)

    Ahhh, so it’s now throwing a notice even though the textdomain is not used. That makes sense. Thanks for clarifying.

    I’ll add a textdomain to make it stop then.

    Plugin Author Ryan Hellyer

    (@ryanhellyer)

    Hopefully this problem is gone with the latest update.

    I included a credit to you in the readme file.

    Thanks for finding the bug 🙂

    Plugin Author Ryan Hellyer

    (@ryanhellyer)

    This update was wrong. I’m fixing it now.

    Plugin Author Ryan Hellyer

    (@ryanhellyer)

    Now it should be fixed.

    The fix I did earlier, was literally just implementing the translations. But I didn’t realise there was the same notice being triggered in the admin panel as before.

    I’m not sure why they’re insisting that translations are done on init, as they work just fine before that. I guess there’s some logic behind it though, just something I’m not thinking of.

    Thanks again for informing me about this. It’s not a problem I thought it would crop up.

    Thread Starter omahoung

    (@omahoung)

    Hi Ryan,

    It works now, thanks for the fix!

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

The topic ‘Translation loading notice since WP 6.8’ is closed to new replies.