I thought retrieving the currently active theme on a WordPress website with WP CLI would involve the “wp theme” command but I was wrong. The correct command to get the currently active theme is “wp option get current_theme”.
wp-cli
WP CLI Find in Post
Sometimes I want a list of blog posts that contain a certain string. For example, I might want a list of all blog posts that contain the word “kazoo” using WP CLI. My favorite tool for this is “wp post list”.
Loop Through WordPress Multisite Blogs with WP CLI
When working on a WordPress multisite with WP CLI, it can be helpful to loop through all of the individual sites.
Quick and Dirty WP CLI
During development or troubleshooting I often find myself wanting to run something through WP CLI. These are some notes on running code through WP CLI.
WP CLI Migrate User Roles
Recently on a project I wanted to migrate WordPress users with a certain role to a different role. This is the command I used.
Revert to Old Version of WordPress Core
These are the two ways I have used to rollback WordPress to an earlier version. Using either technique, you should make a backup copy of your files and your database first!
How to Set Older WordPress Posts to Draft with WP CLI
In one of the slack channels I follow, the question came up on how to set WordPress posts older than a certain date to “draft” status using with WP CLI. I was surprised by how difficult I found this task and wanted to document my solution.
WP CLI Output Results
When working with WP CLI, I often have data to output and instead of looking up how to do it each time, I wanted to make myself some notes.
Install a non-wordpress.org Plugin with WP CLI
The WordPress plugin repository at wordpress.org/plugins is a great resource. I often use WP CLI to install plugins on my WordPress site from there, however, sometimes I want to install other plugins with WP CLI.
WP-CLI move site locally
These are the steps I follow when I move the database for a website to my local computer using WP CLI.