WordPress.org

Ready to get started?Download WordPress

Codex

WPMU Functions/get blog list


This function has been deprecated since Version 3.0. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists. See also wp-includes/deprecated.php. Use wp_get_sites instead.

See the change log for more info.

Contents

Description

Returns an array of arrays containing information about each public blog hosted on this WPMU install. Only blogs marked as public and flagged as safe (mature flag off) are returned. Orders the blog list by registered date in descending order (newest to oldest).

Parameters

$start
(integer) (optional) The first blog to return in the array.
Default: 0
$num
(integer) (optional) The number of blogs to return in the array (thus the size of the array). Setting this to string 'all' returns all blogs from $start.
Default: 10
$deprecated
(integer) (optional) Deprecated.
Default: [blank string]

Return Values

(array) 
Returns an array of arrays each representing a blog hosted on this WPMU install. Details are represented in the following format:
blog_id 
(integer)ID of blog detailed.
domain 
(string) Domain used to access this blog.
path 
(string) Path used to access this blog.
postcount 
(integer) The number of posts in this blog.

Usage

<?php get_blog_list($start$num$deprecated); ?>

Examples

<?php
$blog_list 
get_blog_list0'all' );
foreach (
$blog_list AS $blog) {
    echo 
'Blog '.$blog['blog_id'].': '.$blog['domain'].$blog['path'].'<br />';
}
?>

Notes

  • Orders the blog list by registered date in descending order (newest to oldest). As such, using start and end may slice blogs other than than those desired. An improvement to this would be to sort by blog_id, blogname or even allowing the developer to specify their own order (for example: get_blog_list( 0, 10, true, blogname ).
  • This function is still working, but use it at your own risk, so that the site will not be crashed.

Change Log

Source File

get_blog_list() is located in wp-includes/ms-deprecated.php. Before 3.0.0, it was located in wp-includes/ms-blogs.php.