WordPress 6.7 Debug Message: “code in the plugin or theme running too early”
-
Hello there! We’ve recently started experiencing the following error log message when running our websites in debug mode. Our sites are running WordPress 6.7.1 on PHP 8.2.
PHP Notice: Function _load_textdomain_just_in_time was called <strong>incorrectly</strong>. Translation loading for the <code>acf-icomoon</code> domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the <code>init</code> action or later. Please see <a href="https://developer.ww.wp.xz.cn/advanced-administration/debug/debug-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 6.7.0.) in /home/webuser/public_html/wp-includes/functions.php on line 6114We’ve traced the source of this message to the main acf-icomoon.php file in the plugin’s root folder. We have been patching this locally on sites we manage with the following change…
--- acf-icomoon.php 2024-11-22 10:06:59.000000000 -0500
+++ acf-icomoon-patched.php 2024-11-22 10:27:51.861305200 -0500
@@ -22,28 +22,34 @@
}
/**
- * Definitions
+ * Initialize Plugin
*/
-if(!function_exists('get_plugin_data')){
- require_once(ABSPATH . 'wp-admin/includes/plugin.php');
-}
-$plugin_data = get_plugin_data(__FILE__);
-
-define("ACFICOMOON_VERSION", $plugin_data['Version']);
-define("ACFICOMOON_DIR", plugin_dir_path(__FILE__));
-define("ACFICOMOON_ASSETS_URL", plugin_dir_url(__FILE__) . 'assets/');
-define("ACFICOMOON_STYLESHEET_DIR", get_stylesheet_directory());
-
-/**
- * Include functions
- */
+add_action('init', 'viivue_initialize_plugin');
+function viivue_initialize_plugin(){
+ /**
+ * Definitions
+ */
+ if(!function_exists('get_plugin_data')){
+ require_once(ABSPATH . 'wp-admin/includes/plugin.php');
+ }
+ $plugin_data = get_plugin_data(__FILE__);
+
+ define("ACFICOMOON_VERSION", $plugin_data['Version']);
+ define("ACFICOMOON_DIR", plugin_dir_path(__FILE__));
+ define("ACFICOMOON_ASSETS_URL", plugin_dir_url(__FILE__) . 'assets/');
+ define("ACFICOMOON_STYLESHEET_DIR", get_stylesheet_directory());
+
+ /**
+ * Include functions
+ */
-// helper
-include_once(ACFICOMOON_DIR . 'includes/helper.php');
+ // helper
+ include_once(ACFICOMOON_DIR . 'includes/helper.php');
-// main functions
-include_once(ACFICOMOON_DIR . 'includes/acf-icomoon.php');
+ // main functions
+ include_once(ACFICOMOON_DIR . 'includes/acf-icomoon.php');
+}
/**
* WPBakery Page BuilderPerhaps you’ll have another way you’d want to address this error message, but at the very least we wanted to bring it to your attention. 🙂
The topic ‘WordPress 6.7 Debug Message: “code in the plugin or theme running too early”’ is closed to new replies.