1

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.

4
  • Are you using 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.)
    – Pat J
    Commented May 12, 2014 at 20:48
  • 1
    Also: never hack core. Editing files in the wp-admin directory will cause you grief the next time WordPress updates.
    – Pat J
    Commented May 12, 2014 at 20:50
  • Thanks for the suggestions, I have disabled all plugins and switched to the 2014 theme and its still not working. No I am not using switch_to_blog() anywhere - at least to my knowledge. Commented May 13, 2014 at 14:46
  • Did you try get_blog_option?
    – ojrask
    Commented Nov 24, 2014 at 9:21

1 Answer 1

-2

This may not be the answer in your case, but worth mentioning for anyone in similar situation. You can change "home" in the network admin's edit site page.

Direct link - if you know the blog id number add that to the end of: yoursite.com/wp-admin/network/site-info.php?id=

Or go to: http://yoursite.com/wp-admin/network/sites.php and find and edit the site from there.

2
  • When I view the edit screen for this subsite the settings look okay it has the right path value there. Even if I change the "path" value to something else it still doesn't work. For example, I changed the "path" value for this subsite to /newtest/ and then went and viewed the permalink settings for this subsite and it still doesn't include the "path" value in the suggested permalink options. And when I echo out: get_option('home') it returns the domain for my main network. All other subsites are working fine. Commented May 13, 2014 at 14:43
  • Also, I have disabled all plugins and switched to the 2014 theme and its still not working Commented May 13, 2014 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.