ideas icon indicating copy to clipboard operation
ideas copied to clipboard

Add `wp post export` and `wp post import`

Open miya0001 opened this issue 7 years ago • 2 comments

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

miya0001 avatar Feb 18 '18 05:02 miya0001

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 avatar Feb 20 '18 08:02 schlessera

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

schlessera avatar Feb 20 '18 08:02 schlessera