Created
May 15, 2025 00:47
-
-
Save jkohlbach/b00168612f39ca9a5f1b71c7ca65dd54 to your computer and use it in GitHub Desktop.
Mute _load_textdomain_just_in_time errors mu-plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
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