Skip to content

Instantly share code, notes, and snippets.

@tott
Created July 1, 2014 20:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tott/0cc78e7dcad18024d1c8 to your computer and use it in GitHub Desktop.
Save tott/0cc78e7dcad18024d1c8 to your computer and use it in GitHub Desktop.
Create a full list of sites with domain mapping with wp-cli
for i in `wp site list | cut -f 2 | grep -v url`; do wp --url=$i eval 'global $wpdb, $blog_id; $blogname=get_option("blogname"); $blogurl=home_url(); $domains=$wpdb->get_results( "SELECT * FROM {$wpdb->dmtable} WHERE blog_id = $blog_id;" ); foreach( $domains as $data ) { echo $blog_id.",".$blogname.",".$blogurl.",".$data->domain.",".$data->active."\n"; }'; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment