{{tag>wordpress cli}} ====== WP cli commands ====== ===== Standard WP cli commands ===== [[https://wp-cli.org/#installing|Install wp cli first]] One liner: curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar &&\ chmod +x wp-cli.phar &&\ mv wp-cli.phar /usr/local/bin/wp &&\ wp --info --allow-root Below commands are executed by root user hence the flag --allow-root. ==== Search and replace string in DB ==== Replace https://example.com with https://example.org: wp --path= search-replace 'https://example.com' 'https://example.org' --skip-columns=guid --all-tables --allow-root Same as above but on remote host: wp --ssh=user@example.host.com --path= search-replace 'https://example.com' 'https://example.org' --skip-columns=guid --all-tables --allow-root ==== Update home and site url ==== wp option update home 'http://example.com' wp option update siteurl 'http://example.com' ==== Change user's password ==== wp user update --prompt=user_pass --allow-root ==== Create new admin user ==== wp user create bob bob@example.com --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= --allow-root --user= --format=csv ==== Get order details ==== wp wc shop_order get --path= --allow-root --user= ===== Troubleshooting ===== If the wp cli doesn't output anything, try using ''--skip-plugins'' options wp --debug plugin list --allow-root --skip-plugins ====== Tested on ====== * Debian 10 ====== See also ====== ====== References ====== * https://developer.wordpress.org/cli/commands/ * https://github.com/woocommerce/woocommerce/wiki/WC-CLI-Commands * https://wordpress.org/documentation/article/changing-the-site-url/ * https://wordpress.stackexchange.com/questions/304198/wp-cli-commands-do-nothing-return-nothing