Skip to content

Instantly share code, notes, and snippets.

@Clorith
Last active August 29, 2015 14:00
Show Gist options
  • Save Clorith/11216344 to your computer and use it in GitHub Desktop.
Save Clorith/11216344 to your computer and use it in GitHub Desktop.
<?php
$blogs = $wpdb->get_results( "
SELECT
`blog_id`
FROM
" . $wpdb->blogs . "
" );
foreach( $blogs AS $blog )
{
switch_to_blog( $blog->blog_id );
// default template
echo '
<option value="' . get_bloginfo( 'wpurl' ) . '">' . get_bloginfo( 'name' ) . '</option>
';
restore_current_blog();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment