Automattic\WooCommerce\Internal\Admin

SettingsNavigationFeature::replace_settings_page()protectedWC 1.0

Replace the Settings page in the original WooCommerce menu.

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

Хуков нет.

Возвращает

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

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->replace_settings_page( $page );
$page(массив) (обязательный)
Page used to replace the original.

Код SettingsNavigationFeature::replace_settings_page() 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']}" );
		}
	}
}