Automattic\WooCommerce\Admin\Features\ProductBlockEditor

RedirectionController::get_parsed_route()protectedWC 1.0

Get the parsed WooCommerce Admin path.

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

Хуков нет.

Возвращает

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

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_parsed_route(): array;

Код RedirectionController::get_parsed_route() WC 9.7.1

protected function get_parsed_route(): array {
	if ( ! \Automattic\WooCommerce\Admin\PageController::is_admin_page() || ! isset( $_GET['path'] ) ) {
		return array(
			'page'       => null,
			'product_id' => null,
		);
	}

	$path        = esc_url_raw( wp_unslash( $_GET['path'] ) );
	$path_pieces = explode( '/', wp_parse_url( $path, PHP_URL_PATH ) );

	return array(
		'page'       => $path_pieces[1],
		'product_id' => 'product' === $path_pieces[1] ? absint( $path_pieces[2] ) : null,
	);
}