Created
August 30, 2012 14:46
-
-
Save tlovett1/3529947 to your computer and use it in GitHub Desktop.
Alternative function to get_blogs_list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function tup_get_blogs_info() { | |
if ( ( $results = get_site_option( '_blogs_info_list' ) ) === false ) { | |
global $wpdb; | |
$results = $wpdb->get_results( 'SELECT blog_id, path, domain FROM ' . $wpdb->blogs, ARRAY_A ); | |
foreach ( $results as &$result ) { | |
switch_to_blog( $result['blog_id'] ); | |
$site_info = $wpdb->get_results( 'SELECT option_value FROM ' . $wpdb->options . " WHERE option_name = 'blogname' ", ARRAY_A ); | |
restore_current_blog(); | |
if ( is_array( $site_info ) && is_array( $site_info[0] ) ) | |
$result['blogname'] = $site_info[0]['option_value']; | |
} | |
update_site_option( '_blogs_info_list', $results ); | |
} | |
return $results; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment