From e7fd33fc5e5012d14c29915cb84baa9bec454a0b Mon Sep 17 00:00:00 2001 From: Grzegorz Rola <grola@seostudio.pl> Date: Thu, 14 Nov 2024 15:09:57 +0100 Subject: [PATCH] bugfix(load_plugin_textdomain): revert WP 6.7 changes --- CHANGELOG.md | 4 ++++ src/PluginBootstrap.php | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a52d877..c756371 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 d225d79..ab0e31d 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, -- GitLab