Replace SERVER['REQUEST_URI'] in favor of add_query_arg.

This commit is contained in:
Akeda Bagus 2019-07-15 18:28:33 +07:00
parent f51265e58d
commit 284239ee44
No known key found for this signature in database
GPG Key ID: B21A9FC4B7761412
1 changed files with 2 additions and 5 deletions

View File

@ -75,12 +75,9 @@ class WC_REST_Authentication {
* @return bool
*/
protected function is_request_to_wccom_site_rest_api() {
if ( empty( $_SERVER['REQUEST_URI'] ) ) {
return false;
}
$request_uri = add_query_arg( array() );
$rest_prefix = trailingslashit( rest_get_url_prefix() );
$request_uri = esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) );
$request_uri = esc_url_raw( wp_unslash( $request_uri ) );
return false !== strpos( $request_uri, $rest_prefix . 'wccom-site/' );
}