I am using multisite (subfolders) and have several subsites on it. All have been working fine with no problems however one subsite is now not returning the correct value with get_option( 'home' ) for some reason - it was working fine for a while but just recently stopped working...
So now this subsite cannot create any new pages and link to the correct media etc and when I view the permalinks settings for this subsite none of the options include the assigned subsite path.
So to clarify my problem, I looked at the code in /wp/wp-admin/options-permalink.php and added the following code to line 125:
if ($_GET['debug'] === 'true'){
echo 'current_blog_id: '. get_current_blog_id() .'<br />';
echo 'blogname: '. get_option( 'blogname' ) .'<br />';
echo 'siteurl: '. get_option( 'siteurl' ) .'<br />';
echo 'home: '. get_option( 'home' ) .'<br />';
}
Everything outputs correctly except that get_option( 'home' ) is returning the wrong value for this subsite - it returns the the domain to my primary multisite. so for example it should return: mymultisitenetwork.com/subsite9/ however it just returns: mymultisitenetwork.com/
All the other values are returned correctly ( get_current_blog_id(), get_option( 'blogname' ), get_option( 'siteurl' )
When I check the other subsites in my network the get_option( 'home' ) returns the correct value for that subsite ( like: mymultisitenetwork.com/subsite2/ )
I checked the options table in the database for this subsite "wp_9_options" and it has the correct value in there "mymultisitenetwork.com/subsite9/"
So why when I output echo out get_option( 'home' ) it returns mymultisitenetwork.com/ instead of mymultisitenetwork.com/subsite9/ ??
I even tried clearing the cache before outputting get_option('home') with the following code but that didn't work either - still outputted the wrong data:
$GLOBALS['wp_object_cache']->delete( 'home', 'options' );
Please help to resolve this as this client can no logger create any new pages because of this..
Any help is greatly appreciated - thanks in advance!
Note: because I cannot put links in this post I have removed http:// from the dummy links above.
switch_to_blog()
anywhere? That's one possible culprit. Disable all plugins on the site in question, then see if the issue has gone away. If it has, turn your plugins back on one at a time until it recurs. That plugin is causing the issue. (If no plugin is the culprit, then switch to a default theme. If the issue goes away, then it's the fault of the theme.)wp-admin
directory will cause you grief the next time WordPress updates.get_blog_option
?