@@ -494,6 +494,12 @@ function add_blog_option( $id, $option, $value ) {
494494 wp_cache_delete ( $ id , 'blog-alloptions ' );
495495 wp_cache_delete ( $ id , 'blog-notoptions ' );
496496
497+ // Invalidate site-details cache when a site-detail option changes.
498+ if ( in_array ( $ option , array ( 'home ' , 'siteurl ' , 'blogname ' , 'post_count ' ), true ) ) {
499+ wp_cache_delete ( $ id , 'site-details ' );
500+ wp_cache_delete ( $ id , 'blog-details ' );
501+ }
502+
497503 return false !== $ result ;
498504}
499505
@@ -530,6 +536,12 @@ function delete_blog_option( $id, $option ) {
530536 wp_cache_delete ( $ id , 'blog-alloptions ' );
531537 wp_cache_delete ( $ id , 'blog-notoptions ' );
532538
539+ // Invalidate site-details cache when a site-detail option changes.
540+ if ( in_array ( $ option , array ( 'home ' , 'siteurl ' , 'blogname ' , 'post_count ' ), true ) ) {
541+ wp_cache_delete ( $ id , 'site-details ' );
542+ wp_cache_delete ( $ id , 'blog-details ' );
543+ }
544+
533545 return false !== $ result && $ result > 0 ;
534546}
535547
@@ -553,6 +565,10 @@ function update_blog_option( $id, $option, $value, $deprecated = null ) {
553565 _deprecated_argument ( __FUNCTION__ , '3.1.0 ' );
554566 }
555567
568+ if ( empty ( $ id ) ) {
569+ $ id = get_current_blog_id ();
570+ }
571+
556572 if ( get_current_blog_id () === $ id ) {
557573 return update_option ( $ option , $ value );
558574 }
@@ -597,6 +613,12 @@ function update_blog_option( $id, $option, $value, $deprecated = null ) {
597613 wp_cache_delete ( $ id , 'blog-alloptions ' );
598614 wp_cache_delete ( $ id , 'blog-notoptions ' );
599615
616+ // Invalidate site-details cache when a site-detail option changes.
617+ if ( in_array ( $ option , array ( 'home ' , 'siteurl ' , 'blogname ' , 'post_count ' ), true ) ) {
618+ wp_cache_delete ( $ id , 'site-details ' );
619+ wp_cache_delete ( $ id , 'blog-details ' );
620+ }
621+
600622 return false !== $ result ;
601623}
602624
0 commit comments