Updates, Tips & Tricks

Updates as Released, Plus My Personal Collection Of WordPress Best Practices

Suppress Function _load_textdomain_just_in_time was called incorrectly Notice

29 April

You’re getting this PHP Notice, and it’s cluttering up your logs, and you’re not going to patch upstream WordPress plugins, which would be silly:


Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the someplugin 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.) in /var/www/html/wp-includes/functions.php on line 6121

Copy and paste this into a file, suppress-load-textdomain-notice.php and drop it into your mu-plugins directory (your theme functions.php runs too late):

<?php
/**
 * Plugin Name:  Suppress _load_textdomain_just_in_time 
 * Plugin URI:   https://sozot.com/
 * Description:  Suppress _load_textdomain_just_in_time 
 * Version:      0.0.1
 * Author:       sozot
 * Author URI:   https://sozot.com/
 */

add_action('doing_it_wrong_run', function($function_name, $message, $version) {
    if (
        $function_name === '_load_textdomain_just_in_time'
    ) {
        add_filter('doing_it_wrong_trigger_error', '__return_false', 99);
    }
}, 10, 3);
No comments yet.

Leave a Reply