Skip to content

Instantly share code, notes, and snippets.

@drrobotnik
Created January 18, 2013 04:00
Show Gist options
  • Save drrobotnik/4562249 to your computer and use it in GitHub Desktop.
Save drrobotnik/4562249 to your computer and use it in GitHub Desktop.
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";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment