{"id":323,"date":"2019-11-20T17:13:13","date_gmt":"2019-11-20T16:13:13","guid":{"rendered":"https:\/\/www.easyhost.be\/en\/help\/?post_type=ht_kb&#038;p=323"},"modified":"2020-05-20T18:27:46","modified_gmt":"2020-05-20T16:27:46","slug":"what-is-wp-cli-what-is-wp-cli-used-for","status":"publish","type":"ht_kb","link":"https:\/\/www.easyhost.be\/en\/help\/kb\/what-is-wp-cli-what-is-wp-cli-used-for\/","title":{"rendered":"What is WP-CLI? What is WP-CLI used for?"},"content":{"rendered":"<p>The name comes from &#8216;WordPress Command Line Interface&#8217; &#8211; WP-CLI. You can use WP-CLI to manage WordPress and:<\/p>\n<ul>\n<li>Detect errors and issues and fix them<\/li>\n<li>Bypass using the interface when the backend is unavailable<\/li>\n<li>Do regular maintenance and updates<\/li>\n<\/ul>\n<p>This article lists several useful commands for you, but the list is non-exhaustive. Click on the link to explore more <a href=\"https:\/\/developer.wordpress.org\/cli\/commands\/\" target=\"_blank\" rel=\"noopener\">WP-CLI commands<\/a>.<\/p>\n<h4>IN THIS ARTICLE:<\/h4>\n<ul>\n<li><a href=\"#how\">How do I use WP-CLI<\/a><\/li>\n<li><a href=\"#commando\">User management commands in WP-CLI<\/a><\/li>\n<li><a href=\"#updates\">WordPress updates via WP-CLI<\/a><\/li>\n<li><a href=\"#plugins\">Plugin management<\/a><\/li>\n<\/ul>\n<h2 id=\"how\">How do I use WP-CLI<\/h2>\n<p>WP-CLI is installed on all Webhosting packages in Easyhost. All you have to do is connect to the account via SSH. For Windows you can use a free SSH client such as Putty. For Linux and Mac, simply use your terminal.<\/p>\n<p>All of the following WP-CLI commands have to be executed from the directory where your WordPress website is installed. To change the current directory, simply use the cd command, for example:<\/p>\n<pre><code>cd www\/ \n<\/code><\/pre>\n<h2 id=\"commando\">User management commands in WP-CLI<\/h2>\n<p><strong>Create user<\/strong><\/p>\n<p>This command will create a new user with username &#8220;username&#8221; with the specified permissions, e-mail address and password.<\/p>\n<pre><code>wp user create username-here your-email@address.com --role=administrator --user_pass=password-here\n<\/code><\/pre>\n<p><strong>Delete user<\/strong><\/p>\n<p>This command will delete the user with the specified username &#8211; in this case &#8220;username&#8221;.<\/p>\n<pre><code>wp user delete username\n<\/code><\/pre>\n<p><strong>List all users<\/strong><\/p>\n<p>The following command will show you all users in your CMS with their ID, display name, e-mail address and permissions\/role.<\/p>\n<pre><code>wp user list\n<\/code><\/pre>\n<p><strong>Edit password for a user<\/strong><\/p>\n<p>Use the numeric ID from the output of the previous command to edit the password for a user of your choice<\/p>\n<pre><code>wp user update 1 --user_pass=new-password-here\n<\/code><\/pre>\n<h2 id=\"updates\">WordPress updates via WP-CLI<\/h2>\n<p><strong>WordPress core<\/strong><\/p>\n<p>Check the current WordPress core version:<\/p>\n<pre><code>wp core version\n<\/code><\/pre>\n<p>Update the WordPress core to the latest available version<\/p>\n<pre><code>wp core update\n<\/code><\/pre>\n<p>If you need to update to a particular version, for example if a plugin you use is incompatible with the latest WordPress available, you can force WordPress to update to a version of your choice. The example below would update your CMS to WordPress v4.5<\/p>\n<pre><code>wp core update --version=4.5 --force\n<\/code><\/pre>\n<p><strong>Themes<\/strong><\/p>\n<p>Check the current status and update availability of all themes<\/p>\n<pre><code>wp theme list\n<\/code><\/pre>\n<p>OR<\/p>\n<pre><code>wp theme status\n<\/code><\/pre>\n<p>where you see the name, the version and a letter indicator &#8211; I = Inactive, A = Active, U = Update Available<\/p>\n<p>Check for outdated themes only:<\/p>\n<pre><code>wp theme list | grep \"available\"\n<\/code><\/pre>\n<p>Update all themes:<\/p>\n<pre><code>wp theme update --all\n<\/code><\/pre>\n<p><strong>Plugins<\/strong><\/p>\n<p>Check the current status and update availability of all plugins<\/p>\n<pre><code>wp plugin list\n<\/code><\/pre>\n<p>OR<\/p>\n<pre><code>wp plugin status\n<\/code><\/pre>\n<p>where you see the name, the version and a letter indicator &#8211; I = Inactive, A = Active, U = Update Available<\/p>\n<p>Check for outdated plugins only:<\/p>\n<pre><code>wp plugin list | grep \"available\"\n<\/code><\/pre>\n<p>Update all plugins:<\/p>\n<pre><code>wp plugin update --all\n<\/code><\/pre>\n<p>Update one plugin only:<\/p>\n<pre><code>wp plugin update name-of-plugin\n<\/code><\/pre>\n<h2 id=\"plugins\">Plugin management<\/h2>\n<p><strong>Deactivate all plugins<\/strong><\/p>\n<pre><code>wp plugin deactivate --all\n<\/code><\/pre>\n<p><strong>Activate all plugins<\/strong><\/p>\n<pre><code>wp plugin activate --all\n<\/code><\/pre>\n<p><strong>(De)activate particular plugin<\/strong><\/p>\n<pre><code>wp plugin deactivate name-of-plugin\n<\/code><\/pre>\n<p>OR<\/p>\n<pre><code>wp plugin activate name-of-plugin\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>The name comes from &#8216;WordPress Command Line Interface&#8217; &#8211; WP-CLI. You can use WP-CLI to manage WordPress and: Detect errors and issues and fix them Bypass using the interface when the backend is unavailable Do regular maintenance and updates This article lists several useful commands for you, but the list&#8230;<\/p>\n","protected":false},"author":1,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":{"footnotes":""},"ht-kb-category":[33,32],"ht-kb-tag":[],"acf":[],"_links":{"self":[{"href":"https:\/\/www.easyhost.be\/en\/help\/wp-json\/wp\/v2\/ht-kb\/323"}],"collection":[{"href":"https:\/\/www.easyhost.be\/en\/help\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.easyhost.be\/en\/help\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.easyhost.be\/en\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.easyhost.be\/en\/help\/wp-json\/wp\/v2\/comments?post=323"}],"version-history":[{"count":2,"href":"https:\/\/www.easyhost.be\/en\/help\/wp-json\/wp\/v2\/ht-kb\/323\/revisions"}],"predecessor-version":[{"id":1976,"href":"https:\/\/www.easyhost.be\/en\/help\/wp-json\/wp\/v2\/ht-kb\/323\/revisions\/1976"}],"wp:attachment":[{"href":"https:\/\/www.easyhost.be\/en\/help\/wp-json\/wp\/v2\/media?parent=323"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.easyhost.be\/en\/help\/wp-json\/wp\/v2\/ht-kb-category?post=323"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.easyhost.be\/en\/help\/wp-json\/wp\/v2\/ht-kb-tag?post=323"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}