Every WordPress operator knows wp plugin list and wp db export. The interesting layer is one level deeper — the WP-CLI commands that compose well in shell pipelines, run inside a loaded WordPress context, and replace 50 lines of bespoke PHP. Most teams use four of them and ignore the rest. Here are the 15 that earn their keep.
What’s happening
WP-CLI loads the same WordPress bootstrap as a web request — same plugins active, same hooks fired, same drop-ins respected. That’s what makes commands like wp eval and wp shell different from raw SQL: they see WordPress the way WordPress sees itself. The trade-off is startup cost (each invocation boots WordPress), which is why bulk loops chunk work and stream IDs.
How to verify
Confirm the WordPress WP-CLI install and the loaded context before running any of these:
wp --info
wp core version --extra
wp plugin list --status=active --fields=name,version --format=table
wp config get --constant WP_DEBUG
If wp --info shows a different PHP binary than the web server, the operations below run against a different WordPress runtime than visitors see — fix the PHP path before relying on the output.
What to do
The 15 commands that compose into real WordPress workflows:
wp eval '<php>'— run inline PHP against the loaded WordPress. Use for one-line fixes:wp eval 'wp_cache_flush();'orwp eval 'echo wp_count_posts()->publish;'.wp eval-file <script.php>— same idea but for multi-line scripts you keep in version control next to the runbook.wp shell— interactive REPL with WordPress loaded. Useful for poking at$wpdb, exploringWP_Queryresults, and rehearsing aneval-fileline by line.wp db query '<sql>'— runs SQL with credentials and prefix pulled fromwp-config.php. Pair with--allow-rootonly on environments where the shell user really is the right identity.wp option pluck <key> <subkey>— walks into a serialized option without round-tripping through PHP. Faster thanwp option get | jqon a 200KB option.wp option patch update <key> <subkey> <value>— writes into a serialized option without rewriting the entire array.wp post generate --count=N --post_type=...— fills staging with realistic content for load tests and editorial UAT.wp user generate --count=N --role=subscriber— pairs with the above for membership-flow staging.wp profile stageandwp profile hook— from thewp-cli/profile-commandpackage. Identifies the slowest hook callbacks on a request, far faster than Query Monitor when you need a CLI answer.wp cron event run --due-now— drains the cron queue immediately without waiting for a real request. Pair with--quietin cron jobs.wp transient delete --expired --all— clears stale transients without touching valid ones; respects the object cache drop-in unlike a rawDELETE FROM wp_options.wp search-replace --dry-run --recurse-objects --report-changed-only— the only safe way to preview a domain swap on serialized data before doing it.wp rewrite flush --hard— regenerates.htaccesson Apache; on Nginx it just flushes the rewrite rules. Run after any permalink structure change.wp media regenerate --yes --image_size=thumbnail— regenerate only the size you need, not every variant. Massive time saver on uploads-heavy sites.wp package install <name>— extends WP-CLI itself with community packages.wp-cli/find-command(finds WordPress installs on disk) andwp-cli/profile-commandare the two we install on every operator account.
For a piped workflow that combines several of these, see WordPress fleet batch operations. For the surrounding deploy story, Stack Harbor’s enterprise WordPress operations practice ships these as muscle memory.
If a team’s WordPress operations still go through wp-admin clicks for everything, we can replatform the workflow.