Skip to content

Instantly share code, notes, and snippets.

@jkohlbach
Created May 15, 2025 00:47
Show Gist options
  • Save jkohlbach/b00168612f39ca9a5f1b71c7ca65dd54 to your computer and use it in GitHub Desktop.
Save jkohlbach/b00168612f39ca9a5f1b71c7ca65dd54 to your computer and use it in GitHub Desktop.
Mute _load_textdomain_just_in_time errors mu-plugin
<?php
/**
* Plugin Name: Mute Textdomain Errors
* Plugin URI: https://rymera.com.au
* Description: Mutes textdomain loading errors and logs them for debugging
* Version: 1.0.0
* Author: Rymera Web Co
* Author URI: https://rymera.com.au
* Text Domain: mute-textdomain-errors
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Filter to prevent WordPress from triggering textdomain errors.
* Using the proper hook shown in WordPress core to silently suppress the notices.
*/
add_filter(
'doing_it_wrong_trigger_error',
function ( $trigger, $function ) {
// Only disable errors for the textdomain function.
if ( '_load_textdomain_just_in_time' === $function ) {
return false;
}
return $trigger;
},
10,
2
);
@jkohlbach
Copy link
Author

Are your prod debug logs are filling up with cryptic/useless '_load_textdomain_just_in_time' errors from plugins (that you often have no control over their code base) in the latest WP? Use this mu-plugin to mute them.

How to use:

  • Download this file
  • Put it into your /wp-content/mu-plugins/ folder
  • Enjoy your life

Found this useful?
The biggest thanks you can give me would be to like my X post about it so others can find this too: https://x.com/jkohlbach/status/1922816694843736316

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment