You are viewing this site in a simplified layout because your browser does not yet support CSS Subgrid.

op111.net

Search op111.net

WordPress WP-CLI commands

A selection of WP-CLI commands

CommandComment
$ sudo -u USERNAME -- wp COMMANDRuns COMMAND as user USERNAME
$ sudo wp cli updateUpdates WP-CLI itself
$ wp core update --version=VERSION --forceDowngrades WordPress to specified VERSION (e.g., 5.0.2)
$ wp db cliOpens a MySQL console using credentials from wp-config.php
$ wp db export --add-drop-tableExports database adding DROP TABLE before each CREATE
$ wp media image-sizeLists registered image sizes
$ wp media import *.pngAdds all PNG files in current directory to the media library
$ wp media regenerateRegenerates thumbnails for one or more attachments
$ wp plugin list --status=activeLists all active plugins
$ wp plugin list --status=inactiveLists all inactive plugins
$ wp post delete 99Deletes (to bin) post with ID 99
$ wp post delete $(wp post list --cat=9 --format=ids)Deletes (to bin) all posts in category with ID 9
$ wp post delete $(wp post list --post_status=trash --format=ids)Deletes all posts from the trash
$ wp post update $(wp post list --author=1 --format=ids) --post_author=2Transfers all entries by user w/ ID 1 to user w/ ID 2
$ wp post-type listLists registered post types
$ wp search-replace 'a' 'b' --skip-columns=guidReplaces a with b in database skipping the guid column
$ wp term list categoryLists categories
$ wp user list --orderby=IDLists users ordered by ID

All available WP-CLI commands and subcommands: developer.wordpress.org/cli/commands