WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#21409 closed defect (bug) (invalid)

get_current_site() showing "main" site information only

Reported by: kegster Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.4.1
Component: Multisite Keywords:
Focuses: Cc:

Description

I have a custom theme that i placed var_dump(get_current_site()); in the header.php of the twenty eleven theme and installed it on 3 sites on my multisite. On each site, regardless which one or logged in or not, the var_dump displayed the $current_site of the "main" site. (domain.com). test1.domain.com, test2.domain.com, etc all showed the information for domain.com. I cannot grab the correct site ID. I even did a fresh multisite install with just twentyeleven and had these problems.

Change History (3)

comment:1 @SergeyBiryukov3 years ago

Sounds like you need get_current_blog_id(), get_blog_details(), or $current_blog global instead.

comment:2 @kegster3 years ago

that works actually, but why does get_current_site not work?

comment:3 @SergeyBiryukov3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Severity changed from major to normal
  • Status changed from new to closed

get_current_site() was inherited from MU, and the terminology was different then:
http://nacin.com/2010/03/25/terminology-nightmare-blogs-sites-networks/

$current_blog refers to the current site (in 3.0+ terms), and $current_site refers to the whole network.

Note: See TracTickets for help on using tickets.