[ad_1]
For those of you that use the WordPress CLI tool what do you use it for? What are the actual use cases that you’ve found? I wonder what percentage of WordPress developers use it and what are the typical use cases?
[ad_2]Copyright © 2020 - 2022, Project DMC - WordPress Tutorials for Beginners- All Rights Reserved. Privacy Policy
At the company I work at I’ve used it to write a huge library of monitoring checks, I.e for monitoring software versions.
We also use it as a big part of our backup and staging routine by running exports and updating settings.
I use it to spin up new sites, including the themes & plugins I usually use, with or without demo data, in a few seconds.
Also for doing a search/replace & clearing the cache when pulling/pushing to/from different environments in the development process.
I use WP CLI regularly.
The search-replace function is best-in-class (Imo) for migrating or duplicating sites. The db tools in general are a very efficient toolkit in general.
If you have a big website, some tools can be unreasonably slow for big batch commands. Here too WP CLI shines. Regenerating tens of thousands of images will be faster and more reliable without the overhead of a webui.
Similarly, if you need to build a one-off tool for whatever reason, WP CLI provides a really simple but flexible platform to build on. For example, if you add a meta field and need to resave hundreds or thousands of posts to fill in that field, WP CLI is perfect.
It’s excellent for automating things from the hosting control panel and from cron jobs.
A recent thread with some good examples.
https://www.reddit.com/r/Wordpress/s/VsLVRb4Ef0
We use it in all the ways already mentioned. We also run custom wp commands that can run for days in batches of 100 users for over 200k users and their modifications. I think the search and replace is the best. It’s just very handy.
I use it all the time to migrate sites, or pull down prod sites to work on them locally:
1. `wp db export` on the prod site, dl sql
2. `wp db import db.sql` locally
3. `wp search-replace “example.com” “example.dev”`
and I’m done, makes things super straight forward. It will handle large database (>10GB) as well which migration plugins have a hard time with due to size/timeouts.