Advanced WP-CLI Tricks
I’ve been writing a lot about WP-CLI. There are reasons for that. But the most important is that it’s really cool, and the primary maintainer, Daniel Bachhuber, is doing a great job making the tool better and keeping it healthy. (He’s also, nicely, lowered its bus-factor recently.)
Anyway, all of that is kind of beside the point. The important thing is that if you’re curious about WP-CLI and especially if you already use it but haven’t explored every possible nook-and-cranny you should definitely check out this post from Daniel. In it he quickly runs through ten different really neat tricks that you probably don’t know about. (I only knew three of them.) I think this is my favorite:
wp site empty
If you want to delete all content in your WordPress install, but keep users, options, etc.,
wp site emptyis your new best friend.
So many times I’ve wanted exactly that. There are great plugins that do it, but this is even easier if you’re got WP-CLI running. Those keystrokes vs clicks matter, and this would clearly be faster than any plugin could be.
What’s also great is that the way he made the post. Animated GIF of terminals are pretty great. And they’re great at showing off the features listed out in the post. I think they more than make up for the fact that if you don’t know WP-CLI the post may lose you a bit.
And if the post does lose you, I’ll again call you attention back to my recent posts about using WordPress from the Command Line. 😉