Skip to content

Instantly share code, notes, and snippets.

@n7studios
Created November 25, 2024 05:00
Show Gist options
  • Save n7studios/cec76acd6652ab1cc74f8ca6b8cbba0f to your computer and use it in GitHub Desktop.
Save n7studios/cec76acd6652ab1cc74f8ca6b8cbba0f to your computer and use it in GitHub Desktop.
Disable "Notice: Function _load_textdomain_just_in_time was called incorrectly" in WordPress 6.7
<?php
/**
* Disable `_load_textdomain_just_in_time` `doing_it_wrong` notice
*
* @package ConvertKit
* @author ConvertKit
*
* @wordpress-plugin
* Plugin Name: Disable `_load_textdomain_just_in_time` `doing_it_wrong` notice
* Plugin URI: https://www.wpzinc.com/
* Description: Disable `_load_textdomain_just_in_time` `doing_it_wrong` notice
* Version: 0.0.1
* Author: WP Zinc
* Author URI: https://www.wpzinc.com/
*/
/**
* Prevents the "Notice: Function _load_textdomain_just_in_time was called incorrectly"
* from being output when WP_DEBUG is enabled.
*
* Allows other calls to `_doing_it_wrong` to still output their PHP notices.
*
* @since 0.0.1
*
* @param bool $result Output notice.
* @param string $function_name Function name.
* @return bool
*/
add_filter( 'doing_it_wrong_trigger_error', function( $result, $function_name ) {
// If the notice trigger is for `_load_textdomain_just_in_time`, ignore it.
if ( $function_name === '_load_textdomain_just_in_time' ) {
return false;
}
return $result;
}, 10, 2 );
@Padre2
Copy link

Padre2 commented Mar 30, 2025

Not working for me

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