How to install WP-CLI

WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, set up multisite installs and much more, without using a web browser

cd
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod 755 wp-cli.phar
mv wp-cli.phar wp
mkdir wp_cli
mv wp wp_cli
echo "alias wp='~/wp_cli/wp'" >> ~/.bashrc
source ~/.bashrc

Test it now

wp --info

Some useful wp-cli commands:

wp cli check-update
wp cli update
wp option get siteurl 
wp plugin status
wp plugin update --all
wp plugin list
wp plugin search bulletproof
wp plugin install bulletproof-security
wp plugin install bulletproof-security --force
wp plugin install woocommerce --skip-plugins --force
wp plugin activate bulletproof-security
wp plugin activate bulletproof-security  --network
wp plugin deactivate wordpress-seo 
wp plugin deactivate wordpress-seo --network
wp plugin deactivate plugin --skip-plugins=errorplugin1,errorplugin2 
wp plugin deactivate --all 
wp plugin --skip-plugins deactivate --all 
wp theme status 
wp theme list 
wp theme install twentytwelve --activate
wp theme activate some_theme 
wp theme status --skip-themes
wp theme install twentytwelve --activate --skip-themes
wp core version 
wp core update 
wp core update --force
wp core download --force 
wp option delete core_updater.lock 
wp core update-db
wp cache flush 
wp super-admin list 
wp super-admin add superadmin2 
wp super-admin remove superadmin2
wp user create newadmin [email protected] --role=administrator 
wp user delete username 
wp user delete username --network 
wp user delete ID --reassign=ID 
wp user list 
wp user update ID --user_pass=SoMe_Str0ng_pasSword_here 
wp role reset administrator author contributor 
wp role reset --all
wp user set-role ID administrator
wp db export 
wp db tables 
wp db reset

WordPress Multisite wp-cli examples:

wp site list
wp theme status --url=http://www.example.com/sub/
wp plugin status --url=http://www.example.com/sub/
wp theme activate themename --url=http://www.example.com/sub/
wp plugin activate pluginname --url=http://www.example.com/sub/

!!!To get all wp-cli function worked you have to know that disable_functions in your PHP settings must allow to use shell_exec,exec,proc_close,proc_open

Done!

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *