wp-cli / ideas

💡 Ideas and feature requests are collected here
40 stars 1 forks source link

Add `wp post export` and `wp post import` #86

Open miya0001 opened 6 years ago

miya0001 commented 6 years ago

I feel it will be very useful

$ wp post export --stdout | wp post import --stdin 

If we want to change the CPT:

wp post export --post-type=apple --stdout | wp post import --post-type=orange --stdin 

We had a conversation with @Kenshino at WordCamp Bangkok.

Related: https://github.com/Kenshino/HelpHub/issues/153

schlessera commented 6 years ago

For this specific use case, exporting & re-importing would create a lot of churn in the database, and produce new IDs.

I think a better solution for this use case would be something like this:

wp post update $(wp post list --post_type=apple --format=ids) --post_type=orange
schlessera commented 6 years ago

The mechanism of importing & exporting might still be useful to move from one site to another, though.