Skip to content

Commit a00e994

Browse files
committed
Added support for WP blogs that reside in the folder of a domain.
1 parent 45197ec commit a00e994

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/class-wp-json-authentication-oauth1.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,13 @@ protected function check_oauth_signature( $consumer, $oauth_params, $token = nul
521521

522522
$params = array_merge( $params, $oauth_params );
523523

524-
$base_request_uri = rawurlencode( get_home_url( null, parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH ), 'http' ) );
524+
// Support WP blog roots that point to a folder and not just a domain
525+
$home_url_path = parse_url(get_home_url (null,'','http'), PHP_URL_PATH );
526+
$request_uri_path = parse_url( $_SERVER['REQUEST_URI'], PHP_URL_PATH );
527+
if (substr($request_uri_path, 0, strlen($home_url_path)) == $home_url_path) {
528+
$request_uri_path = substr($request_uri_path, strlen($home_url_path));
529+
}
530+
$base_request_uri = rawurlencode( get_home_url( null, $request_uri_path, 'http' ) );
525531

526532
// get the signature provided by the consumer and remove it from the parameters prior to checking the signature
527533
$consumer_signature = rawurldecode( $params['oauth_signature'] );

0 commit comments

Comments
 (0)