Skip to content

Commit d41b3b5

Browse files
committed
When 'rest_route' URL var is used it's a REST request
1 parent 3aca602 commit d41b3b5

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/WpContext.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,15 @@ final public static function determine(): WpContext
105105
*/
106106
private static function isRestRequest(): bool
107107
{
108-
if (defined('REST_REQUEST') && REST_REQUEST) {
108+
if (
109+
(defined('REST_REQUEST') && REST_REQUEST)
110+
|| !empty($_GET['rest_route']) // phpcs:ignore
111+
) {
109112
return true;
110113
}
111114

112115
if (!get_option('permalink_structure')) {
113-
return !empty($_GET['rest_route']); // phpcs:ignore
116+
return false;
114117
}
115118

116119
/*

0 commit comments

Comments
 (0)