•   PHP Notice:  Function _load_textdomain_just_in_time was called <strong>incorrectly</strong>. Translation loading for the <code>falang</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.ww.wp.xz.cn/advanced-administration/debug/debug-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 6.7.0.) in wp-path/wp-includes/functions.php on line 6123
    [23-Jul-2025 02:52:02 UTC] Array
    (
    [0] => Array
    (
    [file] => wp-path/wp-includes/functions.php
    [line] => 6061
    [function] => wp_trigger_error
    )

    [1] => Array
    (
    [file] => wp-path/wp-includes/l10n.php
    [line] => 1371
    [function] => _doing_it_wrong
    )

    [2] => Array
    (
    [file] => wp-path/wp-includes/l10n.php
    [line] => 1409
    [function] => _load_textdomain_just_in_time
    )

    [3] => Array
    (
    [file] => wp-path/wp-includes/l10n.php
    [line] => 195
    [function] => get_translations_for_domain
    )

    [4] => Array
    (
    [file] => wp-path/wp-includes/l10n.php
    [line] => 307
    [function] => translate
    )

    [5] => Array
    (
    [file] => wp-path/wp-content/plugins/falang/src/Falang/Core/Falang_Mo.php
    [line] => 22
    [function] => __
    )

    [6] => Array
    (
    [file] => wp-path/wp-content/plugins/falang/public/class-falang-public.php
    [line] => 2725
    [function] => __construct
    [class] => Falang\Core\Falang_Mo
    [type] => ->
    )

    [7] => Array
    (
    [file] => wp-path/wp-content/plugins/falang/public/class-falang-public.php
    [line] => 122
    [function] => load_strings_translations
    [class] => Falang_Public
    [type] => ->
    )

    [8] => Array
    (
    [file] => wp-path/wp-includes/class-wp-hook.php
    [line] => 324
    [function] => load
    [class] => Falang_Public
    [type] => ->
    )




Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Alexandre Froger

    (@frogerme)

    Here is how you can solve it:

    class Falang_Mo extends \MO {

    /**
    * Registers the falang_mo custom post type, only at first object creation
    *
    * @since 1.2
    */
    public function __construct() {
    if ( ! post_type_exists( 'falang_mo' ) ) {
    if ( ! has_action( 'init', array( __CLASS__, 'initialize_post_type' ) ) ) {
    add_action( 'init', array( __CLASS__, 'initialize_post_type' ) );
    }
    }
    }

    public static function initialize_post_type() {
    $labels = array( 'name' => __( 'String translations', 'falang' ) );
    register_post_type( 'falang_mo', array( 'labels' => $labels, 'rewrite' => false, 'query_var' => false, '_falang' => true ) );
    }
    Plugin Author sbouey

    (@sbouey)

    Thanks for the solution, i will look at it and add it in the next version.

    The last solution i have make was not working and the string translated by falang was no more working.

    Stéphane

    Thread Starter Alexandre Froger

    (@frogerme)

    I’ve had similar issues in the plugins I develop – I had to not only do a similar change, but in other cases I had to change the architecture to satisfy the new requirement.
    Above is a solution that only :

    • clears the warning
    • adheres to the WordPress requirements (never calling translation functions before hook init)

    In other words, it is a necessary change, but maybe not the only change necessary 🙂

    Plugin Author sbouey

    (@sbouey)

    Hi,

    I have published the version with your fix

    Thanks a lot , Stéphane

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

The topic ‘Warnings – Function _load_textdomain_just_in_time was called incorrectly’ is closed to new replies.