WordPress.org

Ready to get started?Download WordPress

Codex

WPMU Functions/get current site

Contents

Description

Returns the global object $current_site containing various information relating to the site currently being viewed.

get_current_site() was inherited from MU, and uses different terminology. $current_blog refers to the current site (in 3.0+ terms), and $current_site refers to the whole network.

Therefore, see get_current_blog_id(), get_blog_details(), or $current_blog, for individual sites.

Usage

<?php get_current_site(); ?>

Parameters

None.

Return Values

(object) 
An object containing details of the site currently being viewed. Details are represented in the following public variables:
id 
(integer) ID of the site currently being viewed.
domain 
(string) Domain of the site currently being viewed.
path 
(string) Path of the site currently being viewed.
site_name 
(string) Title of the site currently being viewed.

Examples

<?php
$current_site = get_current_site();
echo 'You are viewing ' . $current_site->site_name;
?>

Source File

get_current_site() is located in wp-includes/ms-functions.php.



This page is marked as incomplete. You can help Codex by expanding it.