Last updated: 14-May-2020
In the latter months of 2019, I began to explore more earnestly the command line tool for WordPress, WP-CLI. I quickly discovered that for someone who prefers the keyboard to the mouse, it’s a wonderfully powerful, quick, and robust tool for managing and updating WordPress sites.
A Lightning Talk at the Philly ‘burbs WordPress Meetup
View Dipping into wp-cli on Notist.
In early December, I shared a few quick items that I’d already learned about WP-CLI. I gave a lightning talk at the Philly ‘burbs WordPress Meetup’s 12 Tips of WordPress. The slides embedded above are from that little talk.
What follows below is a resource that I’ve building up for myself. When and where I find documentation and links that I use for growing my knowledge about how to harness the power of WP-CLI, I post them here. Feel free to bookmark this page in your own browser if find it of value.
Commands and Resources for WordPress Generally
Commands for Gravity Forms
- WP-CLI add-on for Gravity Forms on the WordPress plugin repo
- Documentation from Rocket Genius for the WP-CLI add-on
My Own Personal Favorites for WP-CLI
Duplicate a page or post from existing page or post
wp post create --from-post=136 --post_type=page --post_parent=41 --post_title="Insert New Page Title Here"
Delete a User
# Delete user 123 and reassign posts to user 567 $ wp user delete 123 --reassign=567 Success: Removed user 123 from http://example.com
This is very useful when upping a database after installing an SSL certificate or updating A-records on a new website.
wp search-replace 'http://example.com' 'http://example.test' --recurse-objects --skip-columns=guid --skip-tables=wp_users
Bulk Delete Gravity Form Entries
This bit of functionality requires the Gravity Forms CLI Add-On to be installed on the site, but once it’s there, it’s a lightning fast way to bulk delete spammy form submissions.
wp gf entry delete $( wp gf entry list 1 --status=active --format=ids ) --force
List Only Those Plugins with an Available Update
Rather than listing the entire list of plugins running on a WordPress site, it can be helpful to see only those in need of an update.
wp plugin list --update=available