From a40982df076dd0a15c88b5d6cf0ad0a520858138 Mon Sep 17 00:00:00 2001 From: kagg-design Date: Mon, 17 Jul 2023 13:02:53 +0300 Subject: [PATCH] Fix conflict with Cyr2Lat. --- src/php/Settings/Abstracts/SettingsBase.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/php/Settings/Abstracts/SettingsBase.php b/src/php/Settings/Abstracts/SettingsBase.php index 6604cd50..aeca1cb3 100644 --- a/src/php/Settings/Abstracts/SettingsBase.php +++ b/src/php/Settings/Abstracts/SettingsBase.php @@ -167,6 +167,7 @@ public function __construct( $tabs = [] ) { if ( ! $this->is_tab() ) { add_action( 'current_screen', [ $this, 'setup_tabs_section' ], 9 ); + add_action( 'admin_menu', [ $this, 'add_settings_page' ] ); } $this->init(); @@ -197,7 +198,6 @@ protected function init_hooks() { [ $this, 'add_settings_link' ] ); - add_action( 'admin_menu', [ $this, 'add_settings_page' ] ); add_action( 'current_screen', [ $this, 'setup_fields' ] ); add_action( 'current_screen', [ $this, 'setup_sections' ], 11 ); @@ -535,6 +535,12 @@ private function tab_link( $tab ) { * @return bool */ protected function is_tab_active( $tab ) { + $current_page_name = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_FULL_SPECIAL_CHARS ); + + if ( $current_page_name !== $this->option_page() ) { + return false; + } + $current_tab_name = filter_input( INPUT_GET, 'tab', FILTER_SANITIZE_FULL_SPECIAL_CHARS ); if ( null === $current_tab_name ) {