Skip to content

Commit 0036f10

Browse files
committed
Fix manual token creation with plain permalinks
Uses the built-in `get_rest_url` API to handle all situations. Return only the path from `get_rest_uri`
1 parent e3fda4d commit 0036f10

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

wp-includes/rest-api/auth/class-wp-rest-key-pair.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ public function init() {
7373
* @static
7474
*/
7575
public static function get_rest_uri() {
76-
return sprintf( '/%s/%s/%s', rest_get_url_prefix(), self::_NAMESPACE_, self::_REST_BASE_ );
76+
$full_url = get_rest_url( null, sprintf( '/%s/%s', self::_NAMESPACE_, self::_REST_BASE_ ) );
77+
$path = str_replace( site_url( '' ), '', $full_url ); // Remove the protocol and domain from the URI
78+
return $path;
7779
}
7880

7981
/**

0 commit comments

Comments
 (0)