I've been wondering this for a while;

If you run a multisite setup on your WordPress installation, are you able to create a select on the main page (e.g. www.example.com), where the options in the select are the different multisites? Once you select one of the options the browser automatically redirects you to the directory of the multisite (e.g. www.example.com/23).

If yes—how?

1 Answer 1


This method will give you a select menu of active blogs.

function list_all_blogs() {
    global $wpdb;
    $query = "SELECT blog_id FROM " . $wpdb->base_prefix . "blogs WHERE spam != '1' AND archived != '1' AND deleted != '1' AND public = '1' AND blog_id != '1' ORDER BY path";
    $blogs = $wpdb->get_results($query);
    echo '<select id="blog-select">';
    foreach($blogs as $blog) {
        $blog_details = get_blog_details($blog->blog_id);
        echo '<option value="'. $blog_details->siteurl .'">' . $blog_details->blogname .'</option>';
    echo '</select>';
//call the method

You'll need to create a script to navigate to the page on menu select. Something like this:

        window.location.replace( $(this).val() );

There are definitely other ways to accomplish this and perhaps more effecient approaches but I hope this helps.


Your Answer

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

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