From a9953fccf9b52a0a088cd6f68fb0273ff5924ef4 Mon Sep 17 00:00:00 2001 From: Marcus Quinn Date: Sun, 6 Apr 2025 23:09:05 +0100 Subject: [PATCH] Fix issue #15: Load textdomain at init action to prevent 'too early' warnings in WP 6.7+ --- inc/class-wp-ultimo.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/inc/class-wp-ultimo.php b/inc/class-wp-ultimo.php index 0258c32..3a04802 100644 --- a/inc/class-wp-ultimo.php +++ b/inc/class-wp-ultimo.php @@ -231,9 +231,11 @@ final class WP_Ultimo { */ public function setup_textdomain(): void { /* - * Loads the translation files. + * Loads the translation files at the init action to prevent "too early" warnings in WP 6.7+ */ - load_plugin_textdomain('wp-ultimo', false, dirname((string) WP_ULTIMO_PLUGIN_BASENAME) . '/lang'); + add_action('init', function() { + load_plugin_textdomain('wp-ultimo', false, dirname((string) WP_ULTIMO_PLUGIN_BASENAME) . '/lang'); + }); } /**