File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
wp-includes/rest-api/auth Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -374,9 +374,13 @@ public function require_token() {
374
374
$ require_token = false ;
375
375
}
376
376
377
- // GET requests do not require authentication, but if
378
- // the Authorization header is provided, requests should
379
- // be performed as the user corresponding to that token.
377
+ /**
378
+ * GET requests do not typically require authentication, but if the
379
+ * Authorization header is provided, we will use it. WHat's happening
380
+ * here is that `WP_REST_Token::get_auth_header` returns the bearer
381
+ * token or a `WP_Error`. So if we have an error then we can safely skip
382
+ * the GET request.
383
+ */
380
384
if ( 'GET ' === $ request_method && is_wp_error ( $ this ->get_auth_header () ) ) {
381
385
$ require_token = false ;
382
386
}
You can’t perform that action at this time.
0 commit comments