Skip to content

Commit fc80907

Browse files
Explain RESTful WP-CLI v0.2.0
1 parent 42a89fd commit fc80907

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

_posts/2016-07-20-restful-wp-cli-update-4.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,25 @@ Or, if you use a `~/.ssh/config`, `<host>` can be any host alis stored in the SS
5555
Note you will need a copy of WP-CLI on the remote server, accessible as `wp`. Using `--ssh=<host>` won't load your `.bash_profile` if you have a shell alias defined there. [Here's a more thorough explanation](https://runcommand.io/to/wp-ssh-custom-path/) of how you can make `wp` accessible.
5656

5757
### RESTful WP-CLI v0.2.0 and beyond
58+
59+
Today also marks the release of [RESTful WP-CLI](https://github.com/wp-cli/restful) v0.2.0. Among [43 closed issues and pull requests](https://github.com/wp-cli/restful/milestone/2?closed=1), I'd like to highlight two new features.
60+
61+
First, use `wp rest (post|user|comment|*) generate` to create an arbitrary number of any resource:
62+
63+
$ wp @wpdev rest post generate --count=50 --title="Test Post"
64+
Generating items 100% [==============================================] 0:01 / 0:02
65+
66+
When working on a site locally, you often need dummy content to work with. There are a myriad of ways custom post types can store data in the database though, so generating dummy content can be a painstaking process. Because the WP REST API represents a layer of abstraction between the client (e.g. WP-CLI in this case) and the database, it's much easier to produce a general purpose content generation command.
67+
68+
Second, use `wp rest (post|user|comment|*) diff` to compare resources between two enviroments:
69+
70+
$ wp @dev rest command diff @prod find-unused-themes --fields=title
71+
(-) http://runcommand.dev/api/ (+) https://runcommand.io/api/
72+
command:
73+
+ title: find-unused-themes
74+
75+
When working with multiple WordPress environments, you may want to know how these environments differ. Because the WP REST API represents a higher-level abstraction on top of WordPress, computing the difference between two environments becomes a matter of fetching the data and producing a comparison.
76+
77+
Consider both of these new features to be prototypes. They work, but there are many implementation details to be worked out.
78+
79+
tk closing

0 commit comments

Comments
 (0)