Revert "Build the REST API URL before checking for wccom-site"

This reverts commit 0674b421ec.
This commit is contained in:
Justas Butkus 2019-12-03 09:20:28 +02:00
parent 0674b421ec
commit 34f54071bb
1 changed files with 4 additions and 3 deletions

View File

@ -124,12 +124,13 @@ class WC_WCCOM_Site {
* @return bool
*/
protected static function is_request_to_wccom_site_rest_api() {
$route = '/';
$rest_prefix = '';
if ( isset( $_REQUEST['rest_route'] ) ) { // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Recommended
$route = esc_url_raw( get_rest_url( null, wp_unslash( $_REQUEST['rest_route'] ) ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Recommended
if ( isset( $_REQUEST['rest_route'] ) ) {
$route = esc_url_raw( wp_unslash( $_REQUEST['rest_route'] ) );
} else {
$route = esc_url_raw( wp_unslash( add_query_arg( array() ) ) );
$route = esc_url_raw( wp_unslash( add_query_arg( array() ) ) );
$rest_prefix = trailingslashit( rest_get_url_prefix() );
}