Automattic\WooCommerce\Internal\Admin

SettingsNavigationFeature::redirect_core_settings_pages()publicWC 1.0

Redirect the old settings page URLs to the new ones.

Метод класса: SettingsNavigationFeature{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$SettingsNavigationFeature = new SettingsNavigationFeature();
$SettingsNavigationFeature->redirect_core_settings_pages();

Код SettingsNavigationFeature::redirect_core_settings_pages() WC 8.7.0

public function redirect_core_settings_pages() {
	/* phpcs:disable WordPress.Security.NonceVerification */
	if ( ! isset( $_GET['page'] ) || 'wc-settings' !== $_GET['page'] ) {
		return;
	}

	if ( ! current_user_can( 'manage_woocommerce' ) ) {
		return;
	}

	$setting_pages   = \WC_Admin_Settings::get_settings_pages();
	$default_setting = isset( $setting_pages[0] ) ? $setting_pages[0]->get_id() : '';
	$setting         = isset( $_GET['tab'] ) ? sanitize_text_field( wp_unslash( $_GET['tab'] ) ) : $default_setting;
	/* phpcs:enable */

	wp_safe_redirect( wc_admin_url( "&path=/settings/$setting" ) );
	exit;
}