diff --git a/CHANGELOG.md b/CHANGELOG.md index c7563710db81d718e3002600b9f85561d2dd5d6b..e7b2310e06a4f3bbe275bc7ecbdfd0b84b00b98c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ +## [2.0.0] - 2024-11-18 +### Changed +- WordPress 6.7 compatibility: loading text domain + ## [1.2.3] - 2024-11-09 ### Fixed -- Hide doing it wrong notice on production environment +- Hide doing it wrong notice on production environment ## [1.2.2] - 2024-11-09 ### Fixed diff --git a/src/PluginBootstrap.php b/src/PluginBootstrap.php index ab0e31d5a9d7619868807d5974556677ba6fc614..053642610171edea50ad1967ddf76fccd963afaf 100644 --- a/src/PluginBootstrap.php +++ b/src/PluginBootstrap.php @@ -153,18 +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, - basename( $plugin_info->get_plugin_dir() ) . "/$lang_dir/" - ); + add_action( 'init', function () use ( $plugin_info, $lang_dir ) { + \load_plugin_textdomain( + $plugin_info->get_text_domain(), + '', + basename( $plugin_info->get_plugin_dir() ) . "/$lang_dir/" + ); + }); } /**