WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WC_API_Server::get_routes() WC 2.1

Retrieve the route map

The route map is an associative array with path regexes as the keys. The value is an indexed array with the callback function/method as the first item, and a bitmask of HTTP methods as the second item (see the class constants).

Each route can be mapped to more than one callback by using an array of the indexed arrays. This allows mapping e.g. GET requests to one callback and POST requests to another.

Note that the path regexes (array keys) must have @ escaped, as this is used as the delimiter with preg_match()

Это метод класса: WC_API_Server

Возвращает

Массив. '/path/regex' => array($callback,$bitmask) or '/path/regex' => array( array($callback,$bitmask), ...)

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

$WC_API_Server = new WC_API_Server();
$var = $WC_API_Server->get_routes();

Список изменений

С версии 2.1 Введена.

Код WC API Server::get routes: woocommerce/includes/api/legacy/v1/class-wc-api-server.php WC 3.6.5

<?php
public function get_routes() {

	// index added by default
	$endpoints = array(

		'/' => array( array( $this, 'get_index' ), self::READABLE ),
	);

	$endpoints = apply_filters( 'woocommerce_api_endpoints', $endpoints );

	// Normalise the endpoints
	foreach ( $endpoints as $route => &$handlers ) {
		if ( count( $handlers ) <= 2 && isset( $handlers[1] ) && ! is_array( $handlers[1] ) ) {
			$handlers = array( $handlers );
		}
	}

	return $endpoints;
}