Skip to content

Commit

Permalink
Merge pull request #368 from rtCamp/fix/add-setting-tab-on-init-hook
Browse files Browse the repository at this point in the history
Fix _load_textdomain_just_in_time notice in WordPress 6.7
  • Loading branch information
Vedant-Gandhi authored Nov 20, 2024
2 parents 05ec1a7 + 687c116 commit ce90897
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions admin/class-nginx-helper-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand All @@ -94,8 +103,6 @@ public function __construct( $plugin_name, $version ) {
),
)
);

$this->options = $this->nginx_helper_settings();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion includes/class-nginx-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] ) {

Expand Down

0 comments on commit ce90897

Please sign in to comment.