What is the best way of retrieving a list of all blogs and their URLs in a MU network? Can I find them somewhere in the database?

I'm also confused about the database schema. I have two different networks, one network has lots and lots and lots of tables with names such as wp_{id}_posts whereas the other network - which is admittedly much simpler - only has one of each kind of table. Notably it also has a table wp_blogs which I cannot find on the first network.

Could this be because of the first network was installed way back when the MU feature was new (3.0) and the other network is recent (3.4)?

1 Answer 1


You can use something like this

global $wpdb;
$blogs = $wpdb->get_results( $wpdb->prepare( "SELECT blog_id, domain, path FROM 
                             wp_blogs ORDER BY blog_id" ) );

Iterate through $blogs to get what you need.

There is a function get_blog_list(), but it's been deprecated, so you probably shouldn't use it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.