diff --git a/admin/class-nginx-helper-admin.php b/admin/class-nginx-helper-admin.php index 46b04c7..5ecd8bf 100644 --- a/admin/class-nginx-helper-admin.php +++ b/admin/class-nginx-helper-admin.php @@ -78,6 +78,15 @@ public function __construct( $plugin_name, $version ) { $this->plugin_name = $plugin_name; $this->version = $version; + $this->options = $this->nginx_helper_settings(); + } + + /** + * Initialize the settings tab. + * Required since i18n is used in the settings tab which can be invoked only after init hook since WordPress 6.7 + */ + public function initialize_setting_tab() { + /** * Define settings tabs */ @@ -94,8 +103,6 @@ public function __construct( $plugin_name, $version ) { ), ) ); - - $this->options = $this->nginx_helper_settings(); } /** diff --git a/includes/class-nginx-helper.php b/includes/class-nginx-helper.php index 71cb137..2922cd4 100644 --- a/includes/class-nginx-helper.php +++ b/includes/class-nginx-helper.php @@ -169,7 +169,7 @@ private function define_admin_hooks() { global $nginx_helper_admin, $nginx_purger; $nginx_helper_admin = new Nginx_Helper_Admin( $this->get_plugin_name(), $this->get_version() ); - + $this->loader->add_action( 'init', $nginx_helper_admin, 'initialize_setting_tab' ); // Defines global variables. if ( ! empty( $nginx_helper_admin->options['cache_method'] ) && 'enable_redis' === $nginx_helper_admin->options['cache_method'] ) {