Skip to content

Instantly share code, notes, and snippets.

@Zodiac1978
Last active April 23, 2025 06:16
Show Gist options
  • Save Zodiac1978/0371d1371010d267ad15a404b49ba357 to your computer and use it in GitHub Desktop.
Save Zodiac1978/0371d1371010d267ad15a404b49ba357 to your computer and use it in GitHub Desktop.
Log the function name when doing_it_wrong is triggered (best used very early, for example in a mu-plugin)
/**
* Log the function name when doing_it_wrong is triggered
*
* @param string $function_name The function name that triggered the error
*/
function log_function_name( $function_name ) {
// Taken from https://x.com/jkohlbach/status/1912769898171998653
if ('_load textdomain_just_in_time' === $function_name ) {
error_log( wp_debug_backtrace_summary() );
}
}
add_action ('doing_it_wrong_run', 'log_function_name', 10, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment