Automattic\WooCommerce\Internal\Utilities
LegacyRestApiStub::add_rewrite_rules_for_legacy_rest_api_stub
Add the necessary rewrite rules for the Legacy REST API (either the dedicated extension if it's installed, or the stub otherwise).
Method of the class: LegacyRestApiStub{}
No Hooks.
Returns
null. Nothing (null).
Usage
$result = LegacyRestApiStub::add_rewrite_rules_for_legacy_rest_api_stub();
LegacyRestApiStub::add_rewrite_rules_for_legacy_rest_api_stub() LegacyRestApiStub::add rewrite rules for legacy rest api stub code WC 10.7.0
public 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 );
}