drrobotnik
1/18/2013 - 4:00 AM

Modified snippet from Kovshenin. echoing out a multisites list of subdomains for easy copy pasting into your local hosts file.

Modified snippet from Kovshenin. echoing out a multisites list of subdomains for easy copy pasting into your local hosts file.

/* Repurposed from: http://kovshenin.com/2012/wordpress-multisite-with-wildcard-subdomains/
** I found that giving each subdomain their own entry ran significantly faster.
*/

add_action( 'wp_footer', 'print_entry_for_hosts_file' );
function print_entry_for_hosts_file() {
    global $wpdb;
    $domains = $wpdb->get_col( "SELECT domain FROM $wpdb->blogs;" );
    foreach($domains as $domain){
    echo "127.0.0.1 " . $domain . "\n";
  }
}