All Network sites display as main blog

After diving deep into wordpress core files I found out that somewhere along the lines of getting the blog details was a caching function.

It was this line in the ms-blogs.php file.

$details = wp_cache_get( $blog_id . $all, 'blog-details' );

It turns out that I had a cached version of the blog details which messed some things up from the previous install. I checked the wp-config.php file and I did have W3 cache enabled. I temporarily fixed it by doing a flush. I added this code.

global $wp_object_cache;
$wp_object_cache->flush();

After page reloaded I noticed the blog details were showing correctly.

Update

Ok So I think I fixed it for real this time. I disabled the w3 cache plugin but it didn’t work for me so I thought the issue stemmed from somewhere else. I went into the plugins folder after many trial and errors and just decided to rename the w3cache plugin folder to something else. That apparently fixed the issue. I guess something was still referencing the plugin despite it being disabled through WordPress.

The files advanced-cache.php and object-cache.php need to be removed to stop referencing the w3caching plugin.

You can add the plugin again and it may work the second time around.

Just wanted to share that as it drove me nuts for a while.