Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

The get_blog_list() function has been deprecated from v3.0. How does one get a list of blogs in a multisite blog?

share|improve this question

4 Answers 4

up vote 4 down vote accepted

Trac has some discussion and code for possible replacement in future version, ticket #14511 new function - wp_get_sites($args).

share|improve this answer
1  
Until the future release we don't have an alternative to get_blog_list()? –  rsman Dec 18 '10 at 17:18
    
Correct. As far as I know there is currently no native function for this, get_blog_list() documentation says No alternative available. –  Rarst Dec 18 '10 at 17:29
    
Correct. you'll have to use it until it is replaced. –  andrea_r Dec 18 '10 at 23:14

There are plugins for this like http://wordpress.org/extend/plugins/multisite-recent-posts-widget/.

I've used a similar plugin (derivative of the plugin above) code (original source no longer available, hence no link, only found it two weeks ago as well!) to create a Multisite sitemap Page template that lists the most recent 300 new multisites.

You can download my Page template at www.google-adsense-templates.co.uk/seo-plugin/sitemap-multisite.zip will only work with the Talian 05 SEO theme, but you could easily copy the relevant code to your own themes Page template.

David

share|improve this answer

One possibly useful alternative is get_blogs_of_user($user_id).

It provides a perfect alternative, but only if all blogs have been created by the same (admin) user - which works in my case.

share|improve this answer

You could directly query your database.

global $wpdb;

$blogs = $wpdb->get_results( "SELECT * FROM $wpdb->blogs ORDER BY blog_id" );

This will return an array containing all your sites on the network, you can then use a foreach statement to build & populate your own array.

Also remember to carefully read the codex page on interfacing with the WP database when using $wpdb particularly pay attention to the $wpdb->prepare method when doing more advanced queries.

share|improve this answer
    
+1 as it FIXES stuff. Even if not pretty, it works. Thanks. –  kaiser Jul 3 '12 at 13:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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