User Tools

Site Tools


wiki:wp_cli_commands

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
wiki:wp_cli_commands [2022/04/14 15:02] – add create admin user antisawiki:wp_cli_commands [2024/03/27 11:28] (current) – add Troubleshooting antisa
Line 6: Line 6:
 [[https://wp-cli.org/#installing|Install wp cli first]] [[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. Below commands are executed by root user hence the flag --allow-root.
 ==== Search and replace string in DB ==== ==== Search and replace string in DB ====
Line 12: Line 17:
 Replace https://example.com with https://example.org: Replace https://example.com with https://example.org:
  
-  wp --path=<wp installation> search-replace 'https://example.com' 'https://example.org' --all-tables --allow-root+  wp --path=<wp installation> search-replace 'https://example.com' 'https://example.org' --skip-columns=guid --all-tables --allow-root
  
 Same as above but on remote host: Same as above but on remote host:
  
-  wp --ssh=user@example.host.com --path=<wp installation> search-replace 'https://example.com' 'https://example.org' --all-tables --allow-root+  wp --ssh=user@example.host.com --path=<wp installation> 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 ==== ==== Change user's password ====
Line 24: Line 33:
   wp user create bob bob@example.com --role=administrator --allow-root   wp user create bob bob@example.com --role=administrator --allow-root
  
 +
 +==== List all plugins ====
 +  wp plugin list --allow-root
 ===== Woo commerce orders ===== ===== Woo commerce orders =====
  
Line 37: Line 49:
  
  
 +===== Troubleshooting =====
 +If the wp cli doesn't output anything, try using ''--skip-plugins'' options
 +
 +  wp --debug plugin list --allow-root --skip-plugins
 ====== Tested on ====== ====== Tested on ======
   * Debian 10   * Debian 10
Line 43: Line 59:
  
 ====== References ====== ====== References ======
-  *     https://developer.wordpress.org/cli/commands/ +  * https://developer.wordpress.org/cli/commands/ 
-  *     https://github.com/woocommerce/woocommerce/wiki/WC-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
  
wiki/wp_cli_commands.1649941321.txt.gz · Last modified: 2022/04/14 15:02 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