Skip to content

Commit

Permalink
[2.6] [REST API] Added support for WP REST API with custom URL prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiosanches committed Jun 30, 2016
1 parent b63b460 commit ef41395
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 4 additions & 2 deletions includes/api/class-wc-rest-authentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ protected function is_request_to_rest_api() {
return false;
}

$rest_prefix = trailingslashit( rest_get_url_prefix() );;

// Check if our endpoint.
$woocommerce = false !== strpos( $_SERVER['REQUEST_URI'], 'wp-json/wc/' );
$woocommerce = false !== strpos( $_SERVER['REQUEST_URI'], $rest_prefix . 'wc/' );

// Allow third party plugins use our authentication methods.
$third_party = false !== strpos( $_SERVER['REQUEST_URI'], 'wp-json/wc-' );
$third_party = false !== strpos( $_SERVER['REQUEST_URI'], $rest_prefix . 'wc-' );

return apply_filters( 'woocommerce_rest_is_request_to_rest_api', $woocommerce || $third_party );
}
Expand Down
3 changes: 3 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc

== Changelog ==

= 2.6.2 - xx/xx/16 =
* Dev - API - Added support for WP REST API with custom URL prefix.

= 2.6.2 - 30/06/16 =
* Fix - Set max index length on woocommerce_payment_tokenmeta table for utf8mb4 support.
* Fix - is_available check for legacy shipping methods.
Expand Down

0 comments on commit ef41395

Please sign in to comment.