From 61ceb233cda100c521694e32b93605c5dfaf6dfa Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Mon, 9 Feb 2026 11:46:55 +0530 Subject: [PATCH 1/6] Remove 'blog-id-cache' from global cache groups Removed 'blog-id-cache' from global cache groups. --- src/wp-includes/load.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/wp-includes/load.php b/src/wp-includes/load.php index 90318acdddcb4..81c2f6eff650e 100644 --- a/src/wp-includes/load.php +++ b/src/wp-includes/load.php @@ -901,7 +901,6 @@ function wp_start_object_cache() { wp_cache_add_global_groups( array( 'blog-details', - 'blog-id-cache', 'blog-lookup', 'blog_meta', 'global-posts', From 6f70eefdecad8c4c4233a95ffdd479640651b22a Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Mon, 9 Feb 2026 11:47:41 +0530 Subject: [PATCH 2/6] Remove 'blog-id-cache' from cache groups Removed 'blog-id-cache' from global cache groups. --- src/wp-includes/ms-blogs.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/wp-includes/ms-blogs.php b/src/wp-includes/ms-blogs.php index 0be865fd87f13..310069e8031d1 100644 --- a/src/wp-includes/ms-blogs.php +++ b/src/wp-includes/ms-blogs.php @@ -555,7 +555,6 @@ function switch_to_blog( $new_blog_id, $deprecated = null ) { wp_cache_add_global_groups( array( 'blog-details', - 'blog-id-cache', 'blog-lookup', 'blog_meta', 'global-posts', @@ -650,7 +649,6 @@ function restore_current_blog() { wp_cache_add_global_groups( array( 'blog-details', - 'blog-id-cache', 'blog-lookup', 'blog_meta', 'global-posts', From 8c79a93eb888f09be217ca93b8400f497e9ba1d0 Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Mon, 9 Feb 2026 11:48:44 +0530 Subject: [PATCH 3/6] Refactor get_blog_id_from_url by removing cache usage Removed caching logic for blog ID retrieval. --- src/wp-includes/ms-functions.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/wp-includes/ms-functions.php b/src/wp-includes/ms-functions.php index 38b22fcd8c79a..c26e1938675c4 100644 --- a/src/wp-includes/ms-functions.php +++ b/src/wp-includes/ms-functions.php @@ -350,13 +350,6 @@ function get_blog_permalink( $blog_id, $post_id ) { function get_blog_id_from_url( $domain, $path = '/' ) { $domain = strtolower( $domain ); $path = strtolower( $path ); - $id = wp_cache_get( md5( $domain . $path ), 'blog-id-cache' ); - - if ( -1 === $id ) { // Blog does not exist. - return 0; - } elseif ( $id ) { - return (int) $id; - } $args = array( 'domain' => $domain, @@ -369,12 +362,9 @@ function get_blog_id_from_url( $domain, $path = '/' ) { $id = array_shift( $result ); if ( ! $id ) { - wp_cache_set( md5( $domain . $path ), -1, 'blog-id-cache' ); return 0; } - wp_cache_set( md5( $domain . $path ), $id, 'blog-id-cache' ); - return $id; } From a6880f828b95605dc931bd89da0c0a570cac641f Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Mon, 9 Feb 2026 11:49:13 +0530 Subject: [PATCH 4/6] Remove cache deletion for blog-id-cache Removed unnecessary cache deletion for blog-id-cache. --- src/wp-includes/ms-site.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/wp-includes/ms-site.php b/src/wp-includes/ms-site.php index 0058d1a48200d..774b9d459d658 100644 --- a/src/wp-includes/ms-site.php +++ b/src/wp-includes/ms-site.php @@ -992,7 +992,6 @@ function clean_blog_cache( $blog ) { wp_cache_delete( $blog_id, 'blog-details' ); wp_cache_delete( $blog_id . 'short', 'blog-details' ); wp_cache_delete( $domain_path_key, 'blog-lookup' ); - wp_cache_delete( $domain_path_key, 'blog-id-cache' ); wp_cache_delete( $blog_id, 'blog_meta' ); /** From 3be8a857fc3d5d0b13f403f3e90fb60102fd0a38 Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Mon, 9 Feb 2026 11:49:55 +0530 Subject: [PATCH 5/6] Remove 'blog-id-cache' from global cache groups --- tests/phpunit/includes/abstract-testcase.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/phpunit/includes/abstract-testcase.php b/tests/phpunit/includes/abstract-testcase.php index e4eefabfebf69..b3d91d61e5e14 100644 --- a/tests/phpunit/includes/abstract-testcase.php +++ b/tests/phpunit/includes/abstract-testcase.php @@ -435,7 +435,6 @@ public static function flush_cache() { wp_cache_add_global_groups( array( 'blog-details', - 'blog-id-cache', 'blog-lookup', 'blog_meta', 'global-posts', From 6c18742994f15184f98bc5759edc9e97f6759de9 Mon Sep 17 00:00:00 2001 From: Mukesh Panchal Date: Mon, 9 Feb 2026 11:52:11 +0530 Subject: [PATCH 6/6] Remove 'blog-id-cache' assertions from tests Removed assertions for 'blog-id-cache' in various tests to ensure cache behavior is correctly validated without relying on this specific cache key. --- tests/phpunit/tests/multisite/site.php | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/tests/phpunit/tests/multisite/site.php b/tests/phpunit/tests/multisite/site.php index 920a76f6a7e30..489c12e5fc684 100644 --- a/tests/phpunit/tests/multisite/site.php +++ b/tests/phpunit/tests/multisite/site.php @@ -232,7 +232,6 @@ public function test_data_in_cache_after_wpmu_delete_blog_drop_false() { $this->assertFalse( wp_cache_get( $blog_id, 'blog-details' ) ); $this->assertFalse( wp_cache_get( $blog_id . 'short', 'blog-details' ) ); $this->assertFalse( wp_cache_get( $key, 'blog-lookup' ) ); - $this->assertFalse( wp_cache_get( $key, 'blog-id-cache' ) ); } /** @@ -273,7 +272,6 @@ public function test_data_in_cache_after_wpmu_delete_blog_drop_true() { $this->assertFalse( wp_cache_get( $blog_id, 'blog-details' ) ); $this->assertFalse( wp_cache_get( $blog_id . 'short', 'blog-details' ) ); $this->assertFalse( wp_cache_get( $key, 'blog-lookup' ) ); - $this->assertFalse( wp_cache_get( $key, 'blog-id-cache' ) ); } /** @@ -314,7 +312,6 @@ public function test_data_in_cache_after_wpmu_delete_blog_main_site_drop_true() $this->assertFalse( wp_cache_get( $blog_id, 'blog-details' ) ); $this->assertFalse( wp_cache_get( $blog_id . 'short', 'blog-details' ) ); $this->assertFalse( wp_cache_get( $key, 'blog-lookup' ) ); - $this->assertFalse( wp_cache_get( $key, 'blog-id-cache' ) ); } /** @@ -465,7 +462,6 @@ public function test_get_blog_id_from_url() { // Test the original response and cached response for the newly created site. $this->assertSame( $blog_id, get_blog_id_from_url( $details->domain, $details->path ) ); - $this->assertSame( $blog_id, wp_cache_get( $key, 'blog-id-cache' ) ); } /** @@ -491,7 +487,6 @@ public function test_get_blog_id_from_url_that_does_not_exist() { $details = get_site( $blog_id ); $this->assertSame( 0, get_blog_id_from_url( $details->domain, 'foo' ) ); - $this->assertSame( -1, wp_cache_get( md5( $details->domain . 'foo' ), 'blog-id-cache' ) ); } /** @@ -505,7 +500,6 @@ public function test_get_blog_id_from_url_with_deleted_flag() { wpmu_delete_blog( $blog_id ); $this->assertSame( $blog_id, get_blog_id_from_url( $details->domain, $details->path ) ); - $this->assertSame( $blog_id, wp_cache_get( $key, 'blog-id-cache' ) ); } /** @@ -518,9 +512,7 @@ public function test_get_blog_id_from_url_after_dropped() { $key = md5( $details->domain . $details->path ); wpmu_delete_blog( $blog_id, true ); - $this->assertFalse( wp_cache_get( $key, 'blog-id-cache' ) ); $this->assertSame( 0, get_blog_id_from_url( $details->domain, $details->path ) ); - $this->assertSame( -1, wp_cache_get( $key, 'blog-id-cache' ) ); } /** @@ -1042,7 +1034,6 @@ public function data_get_site_caches() { array( '%blog_id%', 'blog-details' ), array( '%blog_id%' . 'short', 'blog-details' ), array( '%domain_path_key%', 'blog-lookup' ), - array( '%domain_path_key%', 'blog-id-cache' ), ); } @@ -1657,11 +1648,9 @@ public function test_wp_update_site_cleans_old_cache_on_domain_change() { // Ensure all respective cache values are empty. $result = array( wp_cache_get( $domain_path_key_old, 'blog-lookup' ), - wp_cache_get( $domain_path_key_old, 'blog-id-cache' ), wp_cache_get( 'current_blog_' . $old_domain, 'site-options' ), wp_cache_get( 'current_blog_' . $old_domain . '/', 'site-options' ), wp_cache_get( $domain_path_key_new, 'blog-lookup' ), - wp_cache_get( $domain_path_key_new, 'blog-id-cache' ), wp_cache_get( 'current_blog_' . $new_domain, 'site-options' ), wp_cache_get( 'current_blog_' . $new_domain . '/', 'site-options' ), ); @@ -1712,10 +1701,8 @@ public function test_wp_update_site_cleans_old_cache_on_path_change() { // Ensure all respective cache values are empty. $result = array( wp_cache_get( $domain_path_key_old, 'blog-lookup' ), - wp_cache_get( $domain_path_key_old, 'blog-id-cache' ), wp_cache_get( 'current_blog_test.wordpress.org' . $old_path, 'site-options' ), wp_cache_get( $domain_path_key_new, 'blog-lookup' ), - wp_cache_get( $domain_path_key_new, 'blog-id-cache' ), wp_cache_get( 'current_blog_test.wordpress.org' . $new_path, 'site-options' ), );