Commit 7a7e43276f for wordpress.org
commit 7a7e43276f008a38e381b3fe7067228c9cb605ae
Author: johnbillion <johnbillion@git.wordpress.org>
Date: Wed Nov 18 13:20:51 2026 +0000
REST API: Only serve `rest_route` requests outside of the admin.
Props xknown, jonsurrell, jeremyfelt.
Built from https://develop.svn.wordpress.org/trunk@65577
git-svn-id: http://core.svn.wordpress.org/trunk@64650 1a063a9b-81f0-0310-95a4-ce76da25c4cd
diff --git a/wp-includes/rest-api.php b/wp-includes/rest-api.php
index f8d5e0a383..d61bb4fe31 100644
--- a/wp-includes/rest-api.php
+++ b/wp-includes/rest-api.php
@@ -454,7 +454,11 @@ function create_initial_rest_routes() {
* @global WP $wp Current WordPress environment instance.
*/
function rest_api_loaded() {
- if ( empty( $GLOBALS['wp']->query_vars['rest_route'] ) ) {
+ /*
+ * Admin screens call wp() for list queries; they are never REST entry points.
+ * Check WP_ADMIN rather than is_admin(), which follows the current screen.
+ */
+ if ( empty( $GLOBALS['wp']->query_vars['rest_route'] ) || defined( 'WP_ADMIN' ) ) {
return;
}
diff --git a/wp-includes/version.php b/wp-includes/version.php
index e6dd647803..238e56b578 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '7.2-RC1-65576';
+$wp_version = '7.2-RC1-65577';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.