Automattic\WooCommerce\Internal\Utilities

LegacyRestApiStub::add_rewrite_rules_for_legacy_rest_api_stub()private staticWC 1.0

Add the necessary rewrite rules for the Legacy REST API (either the dedicated extension if it's installed, or the stub otherwise).

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

Хуков нет.

Возвращает

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

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

$result = LegacyRestApiStub::add_rewrite_rules_for_legacy_rest_api_stub();

Код LegacyRestApiStub::add_rewrite_rules_for_legacy_rest_api_stub() WC 9.3.3

private static function add_rewrite_rules_for_legacy_rest_api_stub() {
	add_rewrite_rule( '^wc-api/v([1-3]{1})/?$', 'index.php?wc-api-version=$matches[1]&wc-api-route=/', 'top' );
	add_rewrite_rule( '^wc-api/v([1-3]{1})(.*)?', 'index.php?wc-api-version=$matches[1]&wc-api-route=$matches[2]', 'top' );
	add_rewrite_endpoint( 'wc-api', EP_ALL );
}