diff --git a/CHANGELOG.md b/CHANGELOG.md index a52d87701b7a8df7c60629a4d53798fd7dd15e7b..c7563710db81d718e3002600b9f85561d2dd5d6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [1.2.3] - 2024-11-09 +### Fixed +- Hide doing it wrong notice on production environment + ## [1.2.2] - 2024-11-09 ### Fixed - Reverted: WordPress 6.7 compatibility: loading text domain diff --git a/src/PluginBootstrap.php b/src/PluginBootstrap.php index d225d798f6e5d7e20bec3b5850ae436be45066ca..ab0e31d5a9d7619868807d5974556677ba6fc614 100644 --- a/src/PluginBootstrap.php +++ b/src/PluginBootstrap.php @@ -153,6 +153,13 @@ final class PluginBootstrap { if ( method_exists( $plugin_info, 'get_language_dir' ) ) { $lang_dir = $plugin_info->get_language_dir(); } + $text_domain = $plugin_info->get_text_domain(); + add_filter( 'doing_it_wrong_trigger_error', function( $doing_it_wrong, $function, $message, $version ) use ( $text_domain ) { + if ( wp_get_environment_type() === 'production' && $function === '_load_textdomain_just_in_time' && strpos( $message, '<code>' . $text_domain . '</code>' ) !== false ) { + return false; + } + return $doing_it_wrong; + }, 10, 4 ); \load_plugin_textdomain( $plugin_info->get_text_domain(), false,