Fahid Javid

Fahid Javid


I’m the CTO at InspiryThemes and creator of top-selling WordPress products, including the RealHomes theme that powers thousands of real estate websites worldwide. I also build and share free WordPress plugins.

August 2025
M T W T F S S
 123
45678910
11121314151617
18192021222324
25262728293031

Categories


How to fix “_load_textdomain_just_in_time was called incorrectly” Notice in WordPress

Fahid JavidFahid Javid

WordPress 6.7 introduced major improvements in internationalization (i18n) and text-domain loading.

If you are a WordPress developer or user, you may have come across this notice after updating to WordPress 6.7 or later.

Notice: Function _load_textdomain_just_in_time was called incorrectly.

First Attempts to Fix (That Didn’t Work)

The Problem (Timing Is Everything)

Since WordPress 4.6 the plugins and themes no longer need load_plugin_textdomain() or load_theme_textdomain() functions. WordPress automatically loads the translations when needed. For more details refer to this WordPress 6.7 release note.

Actually the root cause of this issue occurs when:

The Solution

1) Straight and Easy:
If your theme or plugin doesn’t support WordPress version older than 4.6 then simply remove the load_*_textdomain() call.

2) Disable Auto Registration
Disable the WordPress auto registration for that specific text-domain right before loading the theme or plugin’s translation. Means before load_*_textdomain call.

function disable_textdomain_autoregistration() {  
      
    // Change: 'textdomain-name' here with yours.
    $text_domain_name = 'textdomain-name';  
  
    if ( isset( $GLOBALS['wp_textdomain_registry'] ) ) {  
        try {  
            $registry   = $GLOBALS['wp_textdomain_registry'];  
            $reflection = new ReflectionClass( $registry );  
            if ( $reflection->hasProperty( 'custom_paths' ) ) {  
                $prop = $reflection->getProperty( 'custom_paths' );  
                $prop->setAccessible( true );  
                $custom_paths = $prop->getValue( $registry );  
                if ( isset( $custom_paths[ $text_domain_name ] ) ) {  
                    unset( $custom_paths[ $text_domain_name ] );  
                    $prop->setValue( $registry, $custom_paths );  
                }  
                $prop->setAccessible( false );  
            }  
        } catch ( Exception $e ) {  
            // Optional: log or fail silently  
            error_log( 'Textdomain registry reflection error: ' . $e->getMessage() );  
        }  
    }  
}

So the final implementation should look like this:

disable_textdomain_autoregistration();
load_plugin_textdomain( 'textdomain-name', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );

Important: Replace textdomain-name with your actual text-domain name in both code snippets.

This solution has worked for me consistently. However, as always with WordPress development your way may vary based on your specific setup and requirements. In that case you can post a comment and I will try to help you out 🙂

My name is Fahid and I’m a Full-Stack WordPress Developer. I started working with WordPress community and I’m finding myself learning something new every single day.

Comments 0
There are currently no comments.