-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Feature Request
- Yes, I reviewed the contribution guidelines.
Describe your use case and the problem you are facing
I'd like a more flexible way to export and import data between WordPress installations. The REST API is already pretty good as a foundational building block for this task, and now what is missing is a way to do this securely / on a schedule / flexibly based on a custom query.
Describe the solution you'd like
WP-CLI + SSH would be perfect to fill in the rest of the missing pieces. Here are a couple of example commands:
wp json export posts 'ids=1,2,3&otherparams' --meta=metavalue1,metavalue2- prepare and output a JSON document based on the above parameters.wp json import --match=post_name- import the JSON document from the previous command, using post slugs to match existing posts.ssh -C servername wp json export posts 'ids=1,2,3&otherparams' --meta=metavalue1,metavalue2 | ssh -C servername2 wp json import --match=post_name- combine the previous 2 commands into one.
Calling this new command wp json is pretty logical to me since the default API path is wp-json. This command could also incorporate extra API-related subcommands such as wp json call.
I have seen https://github.com/wp-cli/restful but this proposal is a bit different given the focus on importing and exporting. I will probably be putting together a proof-of-concept sometime this week and I will post it here. At the moment I'm not sure whether it would be easier to start from scratch or try to adapt wp rest to do what I have in mind, any input is welcome.