Skip to content

Commit 043184e

Browse files
committed
Make is_rest the last request and that $wp_rewrite is set
1 parent 2649578 commit 043184e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

inc/functions/compatibility.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ function is_ajax() {
9393
* @return boolean
9494
*/
9595
function is_frontend() {
96+
global $wp_rewrite;
97+
9698
$query = get_query();
9799

98100
$request_uri = isset( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
@@ -104,12 +106,12 @@ function is_frontend() {
104106
is_admin() ||
105107
is_ajax() ||
106108
is_cron() ||
107-
is_rest() ||
108109
( $query && $query->is_admin ) ||
109110
( $query && $query->is_favicon() ) ||
110111
( $query && $query->is_robots() ) ||
111112
strpos( $request_uri, 'favicon.ico' ) !== false ||
112-
strpos( $request_uri, 'robots.txt' ) !== false
113+
strpos( $request_uri, 'robots.txt' ) !== false ||
114+
( $wp_rewrite && is_rest() )
113115
) {
114116
return false;
115117
}

0 commit comments

Comments
 (0)