Automattic\WooCommerce\Internal\Admin

SettingsNavigationFeature::replace_settings_page()protectedWC 1.0

Replace the Settings page in the original WooCommerce menu.

Method of the class: SettingsNavigationFeature{}

No Hooks.

Return

null. Nothing (null).

Usage

// protected - for code of main (parent) or child class
$result = $this->replace_settings_page( $page );
$page(array) (required)
Page used to replace the original.

SettingsNavigationFeature::replace_settings_page() code WC 8.7.0

protected function replace_settings_page( $page ) {
	global $submenu;

	// Check if WooCommerce parent menu has been registered.
	if ( ! isset( $submenu['woocommerce'] ) ) {
		return;
	}

	foreach ( $submenu['woocommerce'] as &$item ) {
		// The "slug" (aka the path) is the third item in the array.
		if ( 0 === strpos( $item[2], 'wc-settings' ) ) {
			$item[2] = wc_admin_url( "&path={$page['path']}" );
		}
	}
}