From 2b693d8e37ab8c1857d4b13609836e108073b5e4 Mon Sep 17 00:00:00 2001 From: Johannes Date: Wed, 17 Dec 2025 16:50:05 +0100 Subject: [PATCH] Fix textdomains not being loaded since WordPress 6.7 Introduced with changes in https://make.wordpress.org/core/2024/10/21/i18n-improvements-6-7/ --- sage/localization.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sage/localization.md b/sage/localization.md index 8428af11..85116060 100644 --- a/sage/localization.md +++ b/sage/localization.md @@ -26,7 +26,11 @@ Add the following to `app/setup.php`: ```php add_action('after_setup_theme', function () { - load_theme_textdomain('sage', get_template_directory() . '/resources/lang'); + if ( version_compare( $GLOBALS['wp_version'], '6.7', '<' ) ) { + load_theme_textdomain( 'sage', get_template_directory() . '/resources/lang' ); + } else { + load_textdomain( 'sage', get_template_directory() . '/resources/lang/' . determine_locale() . '.mo' ); + } }); ```