10up / MU-Migration

This WP-CLI plugin makes the process of moving sites from single WordPress sites to a Multisite instance (or vice-versa) much easier. It exports everything into a zip package which can be used to automatically import it within the desired Multisite installation.
MIT License
329 stars 47 forks source link

Consider adding `--blog_url` or `--blog_name` as an alternate to `--blog_id` #38

Closed jgraup closed 6 years ago

jgraup commented 6 years ago

One issue that I have is that my local multisite blog_id is out of sync with my remote multisite blog_id. It would be much easier to reference the site slug (which is the same in both) instead of the ID which will required an extra call.

blog_id="$(site_url=http://example.test/sitename/; wp site list | awk -v site_url=$site_url '{ if( $2 == site_url ) print $1; }')"; 
echo $blog_id;

For example:

$ wp mu-migration export all subsite.zip --blog_url=http://example.test/sitename/

$ wp mu-migration export all subsite.zip --blog_name=sitename
nicholasio commented 6 years ago

While I haven't tested, you could try running with wp-cli global --url parameter, then you wouldn't need to pass blog id.

$ wp mu-migration export all subsite.zip --url=http://example.test/sitename/