Commit a16e70094d for wordpress.org

commit a16e70094d7024de51f4401833d02b65294ddc20
Author: peterwilsoncc <peterwilsoncc@git.wordpress.org>
Date:   Sun Oct 11 21:20:54 2026 +0000

    Canonical: Generate stable cache for `redirect_guess_404_permalink()`.

    Run `$wpdb->remove_placeholder_escape()` on the prepared database query when generating the cache key.

    The WPDB placeholder varies each time WordPress is executed so without replacement the cache key is unstable resulting in an unreachable cache entry.

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

    Props maheshbohara, therssoftware.
    Fixes #66282.
    See #64250.


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


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

diff --git a/wp-includes/canonical.php b/wp-includes/canonical.php
index 39dcf40685..764668cccd 100644
--- a/wp-includes/canonical.php
+++ b/wp-includes/canonical.php
@@ -1005,7 +1005,8 @@ function redirect_guess_404_permalink() {

 		$query = "SELECT ID FROM $wpdb->posts WHERE $where AND post_status IN ('" . implode( "', '", esc_sql( $publicly_viewable_statuses ) ) . "')";

-		$key          = md5( $query );
+		// Remove the per-request placeholder escape so the cache key is stable across requests.
+		$key          = md5( $wpdb->remove_placeholder_escape( $query ) );
 		$last_changed = wp_cache_get_last_changed( 'posts' );
 		$cache_key    = "redirect_guess_404_permalink:$key";
 		$cache        = wp_cache_get_salted( $cache_key, 'post-queries', $last_changed );
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 7b14cfed13..90c5f561b1 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
  *
  * @global string $wp_version
  */
-$wp_version = '7.2-alpha-64299';
+$wp_version = '7.2-alpha-64300';

 /**
  * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.