Commit 9bc0b07891 for wordpress.org

commit 9bc0b0789162f248499a8a234f959090699fd0f6
Author: westonruter <westonruter@git.wordpress.org>
Date:   Fri Oct 2 00:36:46 2026 +0000

    Code Quality: Declare the `$wp_query` global where it is used.

    The `$wp_query` global is now explicitly declared, along with a `@global` tag, in `wp-activate.php`, `wp-signup.php`, Twenty Ten's `loop.php` and Twenty Twenty-One's `search.php`. The first two files run at the top level and the templates are loaded via `load_template()`, which already declares the global, so there is no change in behavior. The declarations let static analysis see that the variable is defined, resolving six `variable.undefined` errors from the PHPStan baseline.

    Developed in https://github.com/WordPress/wordpress-develop/pull/13810.
    Follow-up to r63019.

    Props mukesh27, westonruter.
    See #65817.

    Built from https://develop.svn.wordpress.org/trunk@64044


    git-svn-id: http://core.svn.wordpress.org/trunk@63203 1a063a9b-81f0-0310-95a4-ce76da25c4cd

diff --git a/wp-activate.php b/wp-activate.php
index ca06d2d537..1de0f60c6c 100644
--- a/wp-activate.php
+++ b/wp-activate.php
@@ -64,6 +64,11 @@ if ( null === $result || ( is_wp_error( $result ) && 'invalid_key' === $result->

 nocache_headers();

+/**
+ * @global WP_Query $wp_query WordPress Query object.
+ */
+global $wp_query;
+
 // Fix for page title.
 $wp_query->is_404 = false;

diff --git a/wp-content/themes/twentyten/loop.php b/wp-content/themes/twentyten/loop.php
index d4ce68ec19..f6a49ff50c 100644
--- a/wp-content/themes/twentyten/loop.php
+++ b/wp-content/themes/twentyten/loop.php
@@ -17,6 +17,11 @@
  * @subpackage Twenty_Ten
  * @since Twenty Ten 1.0
  */
+
+/**
+ * @global WP_Query $wp_query WordPress Query object.
+ */
+global $wp_query;
 ?>

 <?php // Display navigation to next/previous pages when applicable. ?>
diff --git a/wp-content/themes/twentytwentyone/search.php b/wp-content/themes/twentytwentyone/search.php
index 4a7d2d5911..077f52fbc7 100644
--- a/wp-content/themes/twentytwentyone/search.php
+++ b/wp-content/themes/twentytwentyone/search.php
@@ -9,6 +9,11 @@
  * @since Twenty Twenty-One 1.0
  */

+/**
+ * @global WP_Query $wp_query WordPress Query object.
+ */
+global $wp_query;
+
 get_header();

 if ( have_posts() ) {
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 7e54212881..7df0912c28 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '7.2-alpha-64043';
+$wp_version = '7.2-alpha-64044';

 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
diff --git a/wp-signup.php b/wp-signup.php
index eacd0a2272..a53013a76b 100644
--- a/wp-signup.php
+++ b/wp-signup.php
@@ -46,6 +46,11 @@ if ( ! is_main_site() ) {
 	die();
 }

+/**
+ * @global WP_Query $wp_query WordPress Query object.
+ */
+global $wp_query;
+
 // Fix for page title.
 $wp_query->is_404 = false;