#19848 closed defect (bug) (invalid)
Function is_main_site uses $current_site->blog_id instead of $current_site->id
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Multisite | Version: | 3.3.1 |
| Severity: | normal | Keywords: | has-patch reporter-feedback |
| Cc: | moha@… |
Description
The function is_main_site uses $current_site->blog_id to compare if current blog is main site, should instead use $current_site->id. The $current_site->blog_id is not defined. $current_site (from what I can tell) loaded from table wp_site, which doesn't contain any blog_id column.
This leads to issues when trying the registration form for MS sites. I get a redirection-loop for a MS installation.
Attachments (2)
Change History (9)
comment:3
SergeyBiryukov — 16 months ago
- Keywords reporter-feedback added
$current_site->blog_id is defined in wpmu_current_site() and in ms-settings.php:
http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/ms-load.php#L145
http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/ms-settings.php#L47
It's also used in several more places. If it's undefined in your case, I guess we should find the underlying problem. I've just checked wp-signup.php on my install, and $current_site->blog_id is defined there.
Could you describe the steps to reproduce the redirection loop on a clean install?
This is normal when you upgrade from old WordPress MU installs (2.8.x) and do not update wp-config.php to bring it inline with new configurations.
If you defined BLOG_ID_CURRENT_SITE and SITE_ID_CURRENT_SITE in wp-config.php issue will go away.
comment:5
matslundberg — 16 months ago
Yes, this is not a bug but for me it was type-o in a drop-in sunrise.php which made this variable undefined. Thanks for your help, and sorry for the bother.
This issue is resolved.
comment:7
SergeyBiryukov — 16 months ago
- Milestone Awaiting Review deleted

Changed $current_blog->blog_id to $current_blog->id