WP-CLI basic commands and examples
In the previous tutorial describing how to perform the installation of wp-cli on the server vps and today present ways to use it.
In a few seconds or install wordpress plugin.
wp-cli at ease working on the user account is not root. The first thing we'll do it or Open a log on the user selected by us.
I am doing this with root command :
1 | su admin |
admin is of course the user I am logging on to 🙂
the next step is to go to the directory where you want to make operation via wp-cli
1 | cd /home/admin/domains/serwerweb.pl/public_html |
Instant downloads wordpress !
If you want to download files instantly wordpress spend command:
1 | wp core download --locale=pl_PL |
public_html in our website will be uploaded to our wordpress already unpacked in the Polish version
1 2 3 4 5 6 7 8 9 10 11 | wp core download --locale=pl_PL Downloading WordPress 4.9.6 (pl_PL)... Using cached file '/home/admin/.wp-cli/cache/core/wordpress-4.9.6-pl_PL.tar.gz'... Success: WordPress downloaded. admin@vps124:~/domains$ ls default wp-admin wp-includes wp-signup.php index.php wp-blog-header.php wp-links-opml.php wp-trackback.php license.txt wp-comments-post.php wp-load.php xmlrpc.php readme.html wp-config-sample.php wp-login.php suspended wp-content wp-mail.php wp-activate.php wp-cron.php wp-settings.php |
instantly truth?
I create a database in the panel DirectAdmin and doing a standard installation of wordpress.
Installing the plugin!
The prerequisite to install the plugin through the wp-cli, to make it available in the general database plugins – https://pl.wordpress.org/plugins/. Actions do the same for each plug. In this tutorial we will install the plug contact forms 7:
. Go to the WordPress directory for which you want to install the plugin
Grab the name of the plugin from URL: https://pl.wordpress.org/plugins/contact-form-7/ in the case of the plug contact forms 7 It is a contact-form-7
In SSH enter the following command:
1 | wp plugin install contact-form-7. |
If you want to install more than one plug, This type them in the spaces:
1 | wp plugin install contact-form-7 jetpack |
The plug is installed. After this message appears: Success: Installed 1 of 1 plugins.
Activations we installed the plugin using the command:
1 | wp plugin activate contact-form-7 |
Plug the end of the run will be confirmed by an appropriate message Success: Activated 1 of 1 plugins
Update WordPress and plugins!
Step 1. Go to the directory with the installation of WordPress, for example:
1 | cd /home/admin/domains/serwerweb.pl/public_html |
Step 2. Check the version of WordPress in this catalog.
1 | wp core version |
Check for update:
1 | wp core check-update |
If you already know the update is, start it:
1 | wp core update |
2. See a list of plugins:
1 | wp plugin list |
The result will be a table with a list of plugins and information if there are any updates in the form of:
at:
1 2 3 4 5 6 7 | +--------------------+----------+--------+---------+ | name | status | update | version | +--------------------+----------+--------+---------+ | akismet | inactive | none | 3.1.11 | | hello | inactive | none | 1.6 | | wp-multibyte-patch | inactive | none | 2.7 | +--------------------+----------+--------+---------+ |
I recommend immediately update all:
1 | wp plugin update --all |
Of course, you can update only selected plug, for example.:
1 | wp plugin update akismet |
3. At the end of the translation update:
1 | wp core language update |