User Tools

Site Tools


WP cli commands

Standard WP cli commands

Install wp cli first

One liner:

curl -O &&\
chmod +x wp-cli.phar &&\
mv wp-cli.phar /usr/local/bin/wp &&\
wp --info

Below commands are executed by root user hence the flag –allow-root.

Search and replace string in DB

Replace with

wp --path=<wp installation> search-replace '' '' --skip-columns=guid --all-tables --allow-root

Same as above but on remote host:

wp --path=<wp installation> search-replace '' '' --skip-columns=guid --all-tables --allow-root

Update home and site url

wp option update home ''
wp option update siteurl ''

Change user's password

wp user update <username> --prompt=user_pass --allow-root

Create new admin user

wp user create bob --role=administrator --allow-root

List all plugins

wp plugin list --allow-root

Woo commerce orders

List all orders in csv format

wp wc shop_order list --path=<wp installation> --allow-root --user=<user> --format=csv

Get order details

wp wc shop_order get <id> --path=<wp installation> --allow-root --user=<user>

Tested on

  • Debian 10

See also


wiki/wp_cli_commands.txt · Last modified: 2023/04/20 10:34 by antisa

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki