how to use wp-cli

There is a commandline version of the admin tools, called wp-cli, that you can install. However it does not let you run as "root", you have to turn into the web user to run it.


Instruction manual here:


https://developer.wordpress.org/cli/commands/plugin/


https://developer.wordpress.org/cli/commands/theme/


Here are some example commands:


Force a theme update:


sudo -u www-data -i -- wp theme update theme_name --path="/var/www/html/"


Install a plugin (force update):


sudo -u www-data -i -- wp  plugin install akismet --force --path="/var/www/html/"


Bulk install plugins:


cd /var/www/html/wp-content/


for i in `/bin/ls plugins` ; do (  sudo -u www-data -i -- wp  plugin install $i  --force --path="/var/www/html/" ) ; done


Bulk enable or disable plugins:


cd /var/www/html/wp-content/


for i in `/bin/ls plugins` ; do (  sudo -u www-data -i -- wp  plugin toggle $i  --force --path="/var/www/html/" ) ; done


Reinstall the entire site:


sudo -u www-data -i -- wp core download --skip-content --force

sudo -u www-data -i -- wp core update-db --path="/var/www/html"

sudo -u www-data -i -- wp core update --version=x.x --force


note you can leave out the --version and it will go to the latest.

Popular posts from this blog

forcing deactivating of plugins via mysql

turning on debug mode