List Of Useful WP-CLI Commands

List of useful WP-CLI commands to better manage wordpress

Well I thought it would not hurt to put a list of useful commands both for you and for me,because I forget them :)
Let’s start:
1. Deleting revisions

Please note that you must install a package in order for this to work see more here: WordPress Optimization For Speed Improvement

2. Delete transients

3. Delete posts from the trash

4. Delete pending comments

5. See the crons scheduled in json format


6. Delete event scheduled in wordpress cron

7. Optimizing database

8. Fixing database

9. Search and replace in database

10. Check out wordpress version

with –extra we can see more info like database version, language etc…

11. Download wordpress

we can also place additional arguments as:
–path=/path/where/you/want/to/install
–url=claim_that_request_was_made_from_this_website.ro
–skip-plugins[akismet ] // do not download this plug-in

12. Install WordPress

13. See Plugins And Active Plugins

14. Disable plugin

15. View all the themes and active themes

16. Enables default theme

17. Removes comment

18. Disable plugins

19. Delete database

20. Displays tables from database

21. Exports tables from database in csv format


22. Removes comments marked as spam
First install askiment (if you do not already have it)
After which

for multisite we can make a small bash script

If you want more commands https://make.wordpress.org/cli/handbook/commands-cookbook/

wp-cli commands list
wp-cli commands list

Last modified: February 11, 2018