{"id":2173,"date":"2019-08-27T10:59:36","date_gmt":"2019-08-27T10:59:36","guid":{"rendered":"https:\/\/alternative-spaces.com\/blog\/?p=2173"},"modified":"2023-05-12T09:12:59","modified_gmt":"2023-05-12T09:12:59","slug":"what-you-need-to-know-about-the-wordpress-command-line-interface","status":"publish","type":"post","link":"https:\/\/alternative-spaces.com\/blog\/what-you-need-to-know-about-the-wordpress-command-line-interface\/","title":{"rendered":"What You Need to Know about the WordPress Command Line Interface"},"content":{"rendered":"\n<p>Web developers are widely using command line interfaces (CLI) to perform tasks more efficiently, configure their machine, or access features not available through a graphical user interface (GUI). Since we haven\u2019t written about one of Alternative-spaces&#8217;&nbsp;<a href=\"https:\/\/alternative-spaces.com\/blog\/how-long-does-it-take-to-make-a-website\">favorite technologies<\/a>&nbsp;for a while, we dedicate this post to the WordPress console interface.<\/p>\n\n\n\n<p>Although the platform has made comment management, updates, post scheduling, and other tasks simpler, they still take time even for experienced users. The WordPress Command Line Interface, or simply WP-CLI, empowers them to handle the entire WordPress site right from the server\u2019s command line. WP-CLI v2.3.0 should be released in August 2019, intending, as always, to speed up the developer\u2019s workflows.<\/p>\n\n\n\n<p>This article will first explain how to install the tool, then give examples of the WP-CLI use, and list the most valuable CLI commands. If you\u2019re tired of jumping between dashboard tabs to manage your WordPress site, you even don\u2019t need to be a programmer to get the most out of it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Getting Started with the WordPress Command Line Interface<\/strong><\/h2>\n\n\n\n<p>You can install WordPress CLI on MacOS, Microsoft Windows, and Ubuntu. WP-CLI\u2019s requirements for the hosting environment include:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>A UNIX-like environment;<\/li><li>At least PHP 5.4 (we recommend 5.6 or later versions);<\/li><li>WordPress 3.7 or later;<\/li><li>Secure Shell (SSH) access to your hosting environment.<\/li><\/ol>\n\n\n\n<p>Usually, if you need SSH access, you\u2019ll have to use a Virtual Private Server (VPS). If you\u2019re using a UNIX-based system, you can use SSH to connect to a remote server via your native command line. Windows users will have to download an SSH client (Putty is recommended).<\/p>\n\n\n\n<p>There are many ways to install WP-CLI, but the recommended method involves downloading the Phar build. The steps for Linux and OSX are as follows:<\/p>\n\n\n\n<p><strong>1) Access your server\u2019s command line via SSH and download wp-cli.phar using&nbsp;<em>curl<\/em>&nbsp;or&nbsp;<em>wget<\/em>.<\/strong>&nbsp;For example:<\/p>\n\n\n\n<p><em>curl -O https:\/\/raw.githubusercontent.com\/wp-cli\/builds\/gh-pages\/phar\/wp-cli.phar<\/em><\/p>\n\n\n\n<p>This will download the wp-cli.phar file to your root directory.<\/p>\n\n\n\n<p><strong>2) Make the file executable using this command:<\/strong><\/p>\n\n\n\n<p><em>chmod +x wp-cli.phar<\/em><\/p>\n\n\n\n<p>Place the wp-cli.pharfile on your PATH, to a new directory called \u2018wp\u2019:<\/p>\n\n\n\n<p><em>sudo mv wp-cli.phar \/usr\/local\/bin\/wp<\/em><\/p>\n\n\n\n<p>That way, you can call up the application by typing&nbsp;<em>wp<\/em>&nbsp;into your command line. For example, the&nbsp;<em>wp<\/em>&nbsp;<em>command<\/em>&nbsp;allows you to type&nbsp;<em>wp &#8211;info<\/em>&nbsp;instead of&nbsp;<em>php<\/em>&nbsp;<em>wp-cli.phar &#8211;info<\/em>.<\/p>\n\n\n\n<p><strong>3) Test your install.<\/strong>&nbsp;If WP-CLI is installed successfully, the output after running&nbsp;<em>wp &#8211;info<\/em>should look like this:<\/p>\n\n\n\n<p>&nbsp;<em>OS:&nbsp; Linux 4.10.0-42-generic #46~16.04.1-Ubuntu SMP Mon Dec 4 15:57:59 UTC 2017 x86_64<\/em><\/p>\n\n\n\n<p><em>Shell: &nbsp; \/usr\/bin\/zsh<\/em><\/p>\n\n\n\n<p><em>PHP binary:&nbsp; &nbsp; \/usr\/bin\/php<\/em><\/p>\n\n\n\n<p><em>PHP version: &nbsp; &nbsp; 7.1.12-1+ubuntu16.04.1+deb.sury.org+1<\/em><\/p>\n\n\n\n<p><em>php.ini used: &nbsp; \/etc\/php\/7.1\/cli\/php.ini<\/em><\/p>\n\n\n\n<p><em>WP-CLI root dir:&nbsp; &nbsp; &nbsp; &nbsp; \/home\/wp-cli\/.wp-cli<\/em><\/p>\n\n\n\n<p><em>WP-CLI packages dir:&nbsp; &nbsp; \/home\/wp-cli\/.wp-cli\/packages\/<\/em><\/p>\n\n\n\n<p><em>WP-CLI global config: &nbsp; \/home\/wp-cli\/.wp-cli\/config.yml<\/em><\/p>\n\n\n\n<p><em>WP-CLI project config:<\/em><\/p>\n\n\n\n<p><em>WP-CLI version: 1.5.0<\/em><\/p>\n\n\n\n<p>If you\u2019re on Windows, use one of the&nbsp;<a href=\"https:\/\/make.wordpress.org\/cli\/handbook\/installing\/#installing-on-windows\" target=\"_blank\" rel=\"noreferrer noopener\">other installation methods<\/a>. In the end, you should still be able to issue the&nbsp;<em>wp &#8211;info<\/em>&nbsp;command and get a meaningful response.<\/p>\n\n\n\n<p>WP-CLI installed using the Phar method is the easiest to update. You can run&nbsp;<em>wp cli update<\/em>&nbsp;at any time or&nbsp;<em>wp cli update &#8211;nightly<\/em>&nbsp;to use the latest nightly build of WP-CLI.&nbsp;<\/p>\n\n\n\n<p>WP-CLI comes with a tab completion script for Bash and Z shell. Download&nbsp;<a href=\"https:\/\/github.com\/wp-cli\/wp-cli\/raw\/master\/utils\/wp-completion.bash\" target=\"_blank\" rel=\"noreferrer noopener\">wp-completion.bash<\/a>&nbsp;and source it from&nbsp;<em>~\/.bash_profile<\/em>:<\/p>\n\n\n\n<p><em>source \/FULL\/PATH\/TO\/wp-completion.bash<\/em><\/p>\n\n\n\n<p>Then, run&nbsp;<em>source ~\/.bash_profile<\/em>.<\/p>\n\n\n\n<p>Check out the&nbsp;<a href=\"https:\/\/make.wordpress.org\/cli\/handbook\/quick-start\/\" target=\"_blank\" rel=\"noreferrer noopener\">quick start guide<\/a>&nbsp;for a short introduction and some example usage.&nbsp;Some say the WP-CLI tool is not suitable for the average user, and that efficient use of the utility requires at least familiarity with the command line and a slight learning curve. Others claim it\u2019s totally possible to learn without ever leaving the command line itself.<\/p>\n\n\n\n<p>Anyway,&nbsp;what is CLI for WordPress all about?<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>The Benefits of the WordPress Command Line Interface<\/strong><\/h2>\n\n\n\n<p>WP-CLI is all about efficiency. It simplifies the interaction with the WordPress platform. The process includes commands for most of the WordPress tasks that developers encounter daily and dozens of parameters to fine-tune them if necessary.<\/p>\n\n\n\n<p>You can even install WordPress from command line, i.e. using WP-CLI rather than the usual WordPress GUI. Some find the method more streamlined.<\/p>\n\n\n\n<p><a href=\"https:\/\/d9.hosting\/blog\/wp-cli-install-wordpress-from-the-command-line\/\" target=\"_blank\" rel=\"noreferrer noopener\">Here\u2019s how<\/a>&nbsp;you can do it on a shared cPanel hosting account. Basically, you would have to enable SSH access for your account and connect to the server via SSH. Create the project directory that you want to install WordPress in. Navigate to this folder, grab the WordPress core files, and add them to the directory with the&nbsp;<em>wp core download&#8211;version=5.6<\/em>&nbsp;command. Create a new database and database user, and add the user to the database with all privileges. Change the database name to the one that you\u2019ve created for the WordPress site. Then, set up the config file:<\/p>\n\n\n\n<p><em>wp core config &#8211;dbname=wordpress &#8211;dbuser=root &#8211;dbpass=root<\/em><\/p>\n\n\n\n<p>Wait for the confirmation message: \u2018Success: WordPress downloaded.\u2019 Finally, install WordPress via the command line with a single command:<\/p>\n\n\n\n<p><em>wp core install &#8211;url=&#8221;your_domain&#8221; &#8211;title=&#8221;Blog Title&#8221; &#8211;admin_user=&#8221;admin username&#8221; &#8211;admin_password=&#8221;enter_your_password&#8221; &#8211;admin_email=&#8221;enter_your_email&#8221;<\/em><\/p>\n\n\n\n<p>If your install went well, the wp core versioncommand should return a single line indicating which version of WordPress you\u2019re running.<\/p>\n\n\n\n<p>Access to WordPress via the command line is powerful in itself, but you can gain even more control and speed if you use bash scripts. (Bash scripts allow running a sequence of commands with a single one.)&nbsp;<\/p>\n\n\n\n<p>For example, Alternative-spaces\u2019 web developers use the WP-CLI capabilities to automate routine processes at the initial stage of a WordPress project development. We wrote a bash script for internal use which enables us to automatically generate and deploy locally a WordPress project that is ready to be developed. The progress from zero to 100% readiness takes a few minutes.<\/p>\n\n\n\n<p>WP-CLI helps developers manage routine and not so common tasks of a WordPress installation. It can add\/remove users, posts, categories, insert test data, search and replace in the database, reset passwords, help troubleshoot performance issues, and much more.<\/p>\n\n\n\n<p>Another example of the WP-CLI benefits is the case of the White Screen of Death (WSOD). The critical situation can occur for many reasons, including:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>a problem when updating WordPress core, if it was completed incorrectly;<\/li><li>error when installing a new plugin\/theme or updating a plugin\/theme;<\/li><li>error when working with the database;<\/li><li>problem with cached pages.<\/li><\/ul>\n\n\n\n<p>On a live website, errors are not displayed on the front-end. Even having checked the log files on the server, a developer can spend a while trying to fix WSOD. They must manually disable or remove installed plugins and themes via FTP, clear the server cache, change files and directories permissions, and so on.<\/p>\n\n\n\n<p>Thanks to WP-CLI, this issue is usually solved by several commands running in the server console, such as:<\/p>\n\n\n\n<p><em>wp db check<\/em><\/p>\n\n\n\n<p><em>wp db repair<\/em><\/p>\n\n\n\n<p><em>wp cache flush<\/em><\/p>\n\n\n\n<p><em>wp transient delete &#8211;all<\/em><\/p>\n\n\n\n<p><em>wp plugin deactivate &#8211;all<\/em><\/p>\n\n\n\n<p><em>wp theme deactivate &#8211;all<\/em><\/p>\n\n\n\n<p>WP-CLI provides access to many actions you might perform in the WordPress admin, but it also includes commands for things you can\u2019t do there.<\/p>\n\n\n\n<p>The tool is particularly useful for those who are developing their own WordPress plugins or themes. The following chapter contains some of the most critical commands you need for running your WordPress site.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>The Most Useful WP-CLI Commands<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>CLI Commands for the Core, System &amp; Database<\/strong><\/h3>\n\n\n\n<p>With the following WP-CLI commands, the developers can:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Get information about the environment version (operating system, PHP, and CLI):<\/strong><\/li><\/ul>\n\n\n\n<pre class=\"wp-block-preformatted\">wp --info\n<\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"818\" height=\"205\" src=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/Vduawt07sUN5Kr0C7ajS7yXeRgAMjyzG.png\" alt=\"\" class=\"wp-image-2175\" srcset=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/Vduawt07sUN5Kr0C7ajS7yXeRgAMjyzG.png 818w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/Vduawt07sUN5Kr0C7ajS7yXeRgAMjyzG-150x38.png 150w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/Vduawt07sUN5Kr0C7ajS7yXeRgAMjyzG-300x75.png 300w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/Vduawt07sUN5Kr0C7ajS7yXeRgAMjyzG-768x192.png 768w\" sizes=\"auto, (max-width: 818px) 100vw, 818px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Find out the current version of WordPress core:<\/strong><\/li><\/ul>\n\n\n\n<p><em>wp core version<\/em><\/p>\n\n\n\n<p>or<\/p>\n\n\n\n<p><em>wp core version &#8211;extra<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"372\" height=\"70\" src=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/2V4NMg4MZpd6hvRfKR8DYMo-wRtaU-K4A.png\" alt=\"\" class=\"wp-image-2176\" srcset=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/2V4NMg4MZpd6hvRfKR8DYMo-wRtaU-K4A.png 372w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/2V4NMg4MZpd6hvRfKR8DYMo-wRtaU-K4A-150x28.png 150w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/2V4NMg4MZpd6hvRfKR8DYMo-wRtaU-K4A-300x56.png 300w\" sizes=\"auto, (max-width: 372px) 100vw, 372px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Update WordPress core to the latest version:<\/strong><\/li><\/ul>\n\n\n\n<p><em>wp core update<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"887\" height=\"102\" src=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/3aU11W2MxsNfT4OCpycNdvm6ruUyxwnmx.png\" alt=\"\" class=\"wp-image-2177\" srcset=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/3aU11W2MxsNfT4OCpycNdvm6ruUyxwnmx.png 887w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/3aU11W2MxsNfT4OCpycNdvm6ruUyxwnmx-150x17.png 150w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/3aU11W2MxsNfT4OCpycNdvm6ruUyxwnmx-300x34.png 300w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/3aU11W2MxsNfT4OCpycNdvm6ruUyxwnmx-768x88.png 768w\" sizes=\"auto, (max-width: 887px) 100vw, 887px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Download the latest WordPress core:<\/strong><\/li><\/ul>\n\n\n\n<p><em>wp core download<\/em><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Create a WordPress project:<\/strong><\/li><\/ul>\n\n\n\n<p><em>wp core install &#8211;url=${WP_HOME} &#8211;title=&#8221;${WP_BLOG_NAME}&#8221; &#8211;admin_user=${WP_ADMIN_USER} &#8211;admin_password=${WP_ADMIN_PASSWORD} &#8211;admin_email=${WP_ADMIN_MAIL}<\/em><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Change the permanent links structure:<\/strong><\/li><\/ul>\n\n\n\n<p><em>wp rewrite structure &#8216;\/%postname%\/&#8217;<\/em><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Generate the configuration file wp-config.php:<\/strong><\/li><\/ul>\n\n\n\n<p><em>wp config create &#8211;dbname=${DB_NAME} &#8211;dbuser=${DB_USER} &#8211;dbpass=${DB_PASSWORD} &#8211;dbhost=${DB_HOST} &#8211;dbcharset=${DB_CHARSET} &#8211;dbprefix=${DB_PREFIX}<\/em><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Create a database from the data specified in the configuration file wp-config.php:<\/strong><\/li><\/ul>\n\n\n\n<p><em>wp db create<\/em><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Check the database:<\/strong><\/li><\/ul>\n\n\n\n<p><em>wp db check<\/em><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Query the WordPress database:<\/strong><\/li><\/ul>\n\n\n\n<p><em>wp db query &#8220;SELECT COUNT(*) FROM wp_posts;&#8221;<\/em><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Fully export or import the WordPress database:<\/strong><\/li><\/ul>\n\n\n\n<p><em>wp db export wordpress.sql<\/em><\/p>\n\n\n\n<p><em>wp db import wordpress.sql<\/em><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Get an option from the table wp_options:<\/strong><\/li><\/ul>\n\n\n\n<p><em>wp option get blogdescription<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"196\" height=\"18\" src=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/description.jpg\" alt=\"\" class=\"wp-image-2178\" srcset=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/description.jpg 196w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/description-150x14.jpg 150w\" sizes=\"auto, (max-width: 196px) 100vw, 196px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Change an option in the table wp_options:<\/strong><\/li><\/ul>\n\n\n\n<p><em>&nbsp;wp option update blog_public 0<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"348\" height=\"19\" src=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/4zNowwDnY5QWf5ARBgo9eNXKCzxzocDCN.png\" alt=\"\" class=\"wp-image-2179\" srcset=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/4zNowwDnY5QWf5ARBgo9eNXKCzxzocDCN.png 348w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/4zNowwDnY5QWf5ARBgo9eNXKCzxzocDCN-150x8.png 150w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/4zNowwDnY5QWf5ARBgo9eNXKCzxzocDCN-300x16.png 300w\" sizes=\"auto, (max-width: 348px) 100vw, 348px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>WP-CLI Commands for Themes and Plugins<\/strong><\/h2>\n\n\n\n<p>Installation and activation of themes via the WP-CLI are straightforward. A single command can be used to do both:<\/p>\n\n\n\n<p><em>wp theme install twentynineteen &#8211;activate<\/em><\/p>\n\n\n\n<p>The theme installcommand is used with the added activateparameter. If there\u2019s no need to activate a theme at once, just omit this parameter.&nbsp;<\/p>\n\n\n\n<p>Updating themes is simple too: you can use either of the following commands:<\/p>\n\n\n\n<p><em>wp theme update twentynineteen<\/em><\/p>\n\n\n\n<p><em>or<\/em><\/p>\n\n\n\n<p><em>wp theme update &#8211;all<\/em><\/p>\n\n\n\n<p>To check which themes would be updated before using the \u2013all parameter, run it with the &#8211;dry-run parameter:<\/p>\n\n\n\n<p><em>wp theme update &#8211;all &#8211;dry-run<\/em><\/p>\n\n\n\n<p>It\u2019ll return a list of themes that have updates available: you can update the themes either individually or simultaneously.<\/p>\n\n\n\n<p>The following CLI commands further facilitate the&nbsp;work with themes and plugins&nbsp;by enabling developers to:<\/p>\n\n\n\n<p><strong>1. Get a full list of themes installed in the system:<\/strong><\/p>\n\n\n\n<p><em>wp theme list<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"436\" height=\"99\" src=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/5UB5bS5E2tdsof2tPnlVWQBFEy8zuo_7J.png\" alt=\"\" class=\"wp-image-2180\" srcset=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/5UB5bS5E2tdsof2tPnlVWQBFEy8zuo_7J.png 436w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/5UB5bS5E2tdsof2tPnlVWQBFEy8zuo_7J-150x34.png 150w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/5UB5bS5E2tdsof2tPnlVWQBFEy8zuo_7J-300x68.png 300w\" sizes=\"auto, (max-width: 436px) 100vw, 436px\" \/><\/figure>\n\n\n\n<p><strong>2. Activate a downloaded theme:<\/strong><\/p>\n\n\n\n<p><em>wp theme activate twentynineteen<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"410\" height=\"17\" src=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/6ZkQ13LlESlQWMTQU3uAnUrwH8p8a-4SQ.png\" alt=\"\" class=\"wp-image-2181\" srcset=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/6ZkQ13LlESlQWMTQU3uAnUrwH8p8a-4SQ.png 410w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/6ZkQ13LlESlQWMTQU3uAnUrwH8p8a-4SQ-150x6.png 150w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/6ZkQ13LlESlQWMTQU3uAnUrwH8p8a-4SQ-300x12.png 300w\" sizes=\"auto, (max-width: 410px) 100vw, 410px\" \/><\/figure>\n\n\n\n<p>All commands for themes are also valid for plugins. You only have to replace the word \u2018theme\u2019with \u2018plugin\u2019in each of the commands.<\/p>\n\n\n\n<p><strong>3. Get a list of all installed plugins:<\/strong><\/p>\n\n\n\n<p><em>wp plugin list<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"623\" height=\"625\" src=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/7AQN2F2MKIhsL0dmVxsg7jRIOIPxJpPG9.png\" alt=\"\" class=\"wp-image-2182\" srcset=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/7AQN2F2MKIhsL0dmVxsg7jRIOIPxJpPG9.png 623w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/7AQN2F2MKIhsL0dmVxsg7jRIOIPxJpPG9-150x150.png 150w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/7AQN2F2MKIhsL0dmVxsg7jRIOIPxJpPG9-300x300.png 300w\" sizes=\"auto, (max-width: 623px) 100vw, 623px\" \/><\/figure>\n\n\n\n<p><strong>4. Install a plugin from the WordPress.org directory:<\/strong><\/p>\n\n\n\n<p><em>wp plugin install tinymce-advanced<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"959\" height=\"101\" src=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/8cZUcXJk3Ebq1TKc3xSWZ4yI4SA_pmSvf.png\" alt=\"\" class=\"wp-image-2183\" srcset=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/8cZUcXJk3Ebq1TKc3xSWZ4yI4SA_pmSvf.png 959w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/8cZUcXJk3Ebq1TKc3xSWZ4yI4SA_pmSvf-150x16.png 150w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/8cZUcXJk3Ebq1TKc3xSWZ4yI4SA_pmSvf-300x32.png 300w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/8cZUcXJk3Ebq1TKc3xSWZ4yI4SA_pmSvf-768x81.png 768w\" sizes=\"auto, (max-width: 959px) 100vw, 959px\" \/><\/figure>\n\n\n\n<p><strong>5. Activate a plugin:<\/strong><\/p>\n\n\n\n<p><em>wp plugin activate tinymce-advanced<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"326\" height=\"37\" src=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/9bj9FLxb5RzDNoMbKkKe8LhbIS0b9wB.png\" alt=\"\" class=\"wp-image-2184\" srcset=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/9bj9FLxb5RzDNoMbKkKe8LhbIS0b9wB.png 326w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/9bj9FLxb5RzDNoMbKkKe8LhbIS0b9wB-150x17.png 150w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/9bj9FLxb5RzDNoMbKkKe8LhbIS0b9wB-300x34.png 300w\" sizes=\"auto, (max-width: 326px) 100vw, 326px\" \/><\/figure>\n\n\n\n<p>You can install plugins not only from the repository but also from remote files. It\u2019s great if you\u2019re developing a plugin or using a premium one. For example, the following command installs two plugins from the repository and one from an Amazon S3 server:<\/p>\n\n\n\n<p><em>wp plugin install advanced-custom-fields jetpack https:\/\/d2qas3txbec7n.cloudfront.net\/wp-content\/uploads\/2019\/07\/myplugin.zip &#8211;activate<\/em><\/p>\n\n\n\n<p><strong>6.<\/strong><strong>&nbsp;Deactivate a plugin:<\/strong><\/p>\n\n\n\n<p><em>wp plugin deactivate bbpress<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"334\" height=\"34\" src=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/10h5sHVw09m09NutRyL_SYOVcPYoAPsjPyB.png\" alt=\"\" class=\"wp-image-2185\" srcset=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/10h5sHVw09m09NutRyL_SYOVcPYoAPsjPyB.png 334w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/10h5sHVw09m09NutRyL_SYOVcPYoAPsjPyB-150x15.png 150w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/10h5sHVw09m09NutRyL_SYOVcPYoAPsjPyB-300x31.png 300w\" sizes=\"auto, (max-width: 334px) 100vw, 334px\" \/><\/figure>\n\n\n\n<p>You can name multiple plugins simultaneously or use the \u2013all parameter. The latter can be handy if you\u2019re troubleshooting compatibility issues and need to deactivate all the plugins at once. Later, you might go back and enable them one by one, testing as you go.<\/p>\n\n\n\n<p><strong>7.<\/strong><strong>&nbsp;Update a plugin:<\/strong><\/p>\n\n\n\n<p><em>wp plugin update contact-form-7<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"819\" height=\"224\" src=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/11mZ3P9ZkU3F6ZaxNHXnPgcNa1ZJw65NxU.png\" alt=\"\" class=\"wp-image-2186\" srcset=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/11mZ3P9ZkU3F6ZaxNHXnPgcNa1ZJw65NxU.png 819w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/11mZ3P9ZkU3F6ZaxNHXnPgcNa1ZJw65NxU-150x41.png 150w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/11mZ3P9ZkU3F6ZaxNHXnPgcNa1ZJw65NxU-300x82.png 300w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/11mZ3P9ZkU3F6ZaxNHXnPgcNa1ZJw65NxU-768x210.png 768w\" sizes=\"auto, (max-width: 819px) 100vw, 819px\" \/><\/figure>\n\n\n\n<p><strong>8.<\/strong><strong>&nbsp;Delete a plugin:<\/strong><\/p>\n\n\n\n<p><em>wp plugin delete tinymce-advanced<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"304\" height=\"35\" src=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/12QmiPU0qTEkqQNNupF-kPm6_fOgVz_eYc.png\" alt=\"\" class=\"wp-image-2187\" srcset=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/12QmiPU0qTEkqQNNupF-kPm6_fOgVz_eYc.png 304w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/12QmiPU0qTEkqQNNupF-kPm6_fOgVz_eYc-150x17.png 150w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/12QmiPU0qTEkqQNNupF-kPm6_fOgVz_eYc-300x35.png 300w\" sizes=\"auto, (max-width: 304px) 100vw, 304px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>WP-CLI Commands for Posts, Pages, Comments &amp; Users<\/strong><\/h2>\n\n\n\n<p>The commands allow the developers to do the following quickly and easily:&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Get a list of all posts:<\/strong><\/li><\/ul>\n\n\n\n<p><em>wp post list<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"634\" height=\"233\" src=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/13_lgApKruglys3XteOpq9DggDRV8zx6f5.png\" alt=\"\" class=\"wp-image-2188\" srcset=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/13_lgApKruglys3XteOpq9DggDRV8zx6f5.png 634w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/13_lgApKruglys3XteOpq9DggDRV8zx6f5-150x55.png 150w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/13_lgApKruglys3XteOpq9DggDRV8zx6f5-300x110.png 300w\" sizes=\"auto, (max-width: 634px) 100vw, 634px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Get a list of all pages:<\/strong><\/li><\/ul>\n\n\n\n<p><em>wp post list &#8211;post_type=page<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"721\" height=\"234\" src=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/14etypfqNZuivZcpHbdVgAnoXvGaEvV2PT.png\" alt=\"\" class=\"wp-image-2189\" srcset=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/14etypfqNZuivZcpHbdVgAnoXvGaEvV2PT.png 721w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/14etypfqNZuivZcpHbdVgAnoXvGaEvV2PT-150x49.png 150w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/14etypfqNZuivZcpHbdVgAnoXvGaEvV2PT-300x97.png 300w\" sizes=\"auto, (max-width: 721px) 100vw, 721px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Get a list of all comments:<\/strong><\/li><\/ul>\n\n\n\n<p><em>wp comment list<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"812\" height=\"302\" src=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/15ToA1zs576ZKSbfiV6N5ecCcXhwuxPIGb.png\" alt=\"\" class=\"wp-image-2190\" srcset=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/15ToA1zs576ZKSbfiV6N5ecCcXhwuxPIGb.png 812w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/15ToA1zs576ZKSbfiV6N5ecCcXhwuxPIGb-150x56.png 150w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/15ToA1zs576ZKSbfiV6N5ecCcXhwuxPIGb-300x112.png 300w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/15ToA1zs576ZKSbfiV6N5ecCcXhwuxPIGb-768x286.png 768w\" sizes=\"auto, (max-width: 812px) 100vw, 812px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Mark a comment as spam:<\/strong><\/li><\/ul>\n\n\n\n<p><em>wp comment spam 14<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"318\" height=\"17\" src=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/16Epgf_3Nm5joV1H_i4frpQXJqwhJorvFM.png\" alt=\"\" class=\"wp-image-2191\" srcset=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/16Epgf_3Nm5joV1H_i4frpQXJqwhJorvFM.png 318w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/16Epgf_3Nm5joV1H_i4frpQXJqwhJorvFM-150x8.png 150w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/16Epgf_3Nm5joV1H_i4frpQXJqwhJorvFM-300x16.png 300w\" sizes=\"auto, (max-width: 318px) 100vw, 318px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Delete a comment:<\/strong><\/li><\/ul>\n\n\n\n<p>wp comment delete 15 &#8211;force<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"252\" height=\"18\" src=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/17p-Mm7QkuHebdPTeQLVbPmtraQBNTPcUF.png\" alt=\"\" class=\"wp-image-2192\" srcset=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/17p-Mm7QkuHebdPTeQLVbPmtraQBNTPcUF.png 252w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/17p-Mm7QkuHebdPTeQLVbPmtraQBNTPcUF-150x11.png 150w\" sizes=\"auto, (max-width: 252px) 100vw, 252px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Get a list of users:<\/strong><\/li><\/ul>\n\n\n\n<p><em>wp user list<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"164\" src=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/18UsO8dzgkiCR5LaNSNtY0R2TkvG02l3Yv-1024x164.png\" alt=\"\" class=\"wp-image-2193\" srcset=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/18UsO8dzgkiCR5LaNSNtY0R2TkvG02l3Yv-1024x164.png 1024w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/18UsO8dzgkiCR5LaNSNtY0R2TkvG02l3Yv-150x24.png 150w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/18UsO8dzgkiCR5LaNSNtY0R2TkvG02l3Yv-300x48.png 300w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/18UsO8dzgkiCR5LaNSNtY0R2TkvG02l3Yv-768x123.png 768w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/18UsO8dzgkiCR5LaNSNtY0R2TkvG02l3Yv.png 1055w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Create a new user:<\/strong><\/li><\/ul>\n\n\n\n<p><em>wp user create bob bob@example.com &#8211;role=author<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"314\" height=\"36\" src=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/19-evLb6gEdwr3_-2EXrzUuZMvl8gUgsg7.png\" alt=\"\" class=\"wp-image-2194\" srcset=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/19-evLb6gEdwr3_-2EXrzUuZMvl8gUgsg7.png 314w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/19-evLb6gEdwr3_-2EXrzUuZMvl8gUgsg7-150x17.png 150w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/19-evLb6gEdwr3_-2EXrzUuZMvl8gUgsg7-300x34.png 300w\" sizes=\"auto, (max-width: 314px) 100vw, 314px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Update the details of the user with ID=8:<\/strong><\/li><\/ul>\n\n\n\n<p><em>wp user update 8 &#8211;display_name=Mary<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"220\" height=\"18\" src=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/20MMWmAXFVRjnCZGxcYGNJa3k15p6dHYrr.png\" alt=\"\" class=\"wp-image-2195\" srcset=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/20MMWmAXFVRjnCZGxcYGNJa3k15p6dHYrr.png 220w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/20MMWmAXFVRjnCZGxcYGNJa3k15p6dHYrr-150x12.png 150w\" sizes=\"auto, (max-width: 220px) 100vw, 220px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Get the details of the user with ID=8:<\/strong><\/li><\/ul>\n\n\n\n<p><em>wp user get 8<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"372\" height=\"166\" src=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/21YmOhrO1qxLXedk3IPxtdLpxP-095uy.png\" alt=\"\" class=\"wp-image-2197\" srcset=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/21YmOhrO1qxLXedk3IPxtdLpxP-095uy.png 372w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/21YmOhrO1qxLXedk3IPxtdLpxP-095uy-150x67.png 150w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/21YmOhrO1qxLXedk3IPxtdLpxP-095uy-300x134.png 300w\" sizes=\"auto, (max-width: 372px) 100vw, 372px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Get the metadata of the user with ID=8:<\/strong><\/li><\/ul>\n\n\n\n<p><em>wp user meta list 8<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"482\" height=\"338\" src=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/22amMCXFCx8okl-dS5qh5cKiZcR7PAO1-r.png\" alt=\"\" class=\"wp-image-2198\" srcset=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/22amMCXFCx8okl-dS5qh5cKiZcR7PAO1-r.png 482w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/22amMCXFCx8okl-dS5qh5cKiZcR7PAO1-r-150x105.png 150w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/22amMCXFCx8okl-dS5qh5cKiZcR7PAO1-r-300x210.png 300w\" sizes=\"auto, (max-width: 482px) 100vw, 482px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li><strong>Delete the user with ID=8 and reassign their posts to the user with ID=9:<\/strong><\/li><\/ul>\n\n\n\n<p><em>wp user delete 8 &#8211;reassign=9<\/em><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"459\" height=\"19\" src=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/23ZsSBJoDY8bwO84O2ilrRdQbiNN0Zt5qd.png\" alt=\"\" class=\"wp-image-2199\" srcset=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/23ZsSBJoDY8bwO84O2ilrRdQbiNN0Zt5qd.png 459w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/23ZsSBJoDY8bwO84O2ilrRdQbiNN0Zt5qd-150x6.png 150w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/23ZsSBJoDY8bwO84O2ilrRdQbiNN0Zt5qd-300x12.png 300w\" sizes=\"auto, (max-width: 459px) 100vw, 459px\" \/><\/figure>\n\n\n\n<p>There\u2019s detailed documentation for each of the parameters. You can get it by typing&nbsp;<em>wp &#8211;help&nbsp;<\/em>in the command line. It\u2019ll return a complete list of the top-level&nbsp;<a href=\"https:\/\/developer.wordpress.org\/cli\/commands\/\" target=\"_blank\" rel=\"noreferrer noopener\">WP-CLI commands<\/a>. If you want to learn what each of them does, you\u2019ll have to expand upon the helpcommand, e.g.,&nbsp;<em>wp help theme install<\/em>. The list of the commands and their parameters is also available on the&nbsp;<a href=\"https:\/\/make.wordpress.org\/cli\/\" target=\"_blank\" rel=\"noreferrer noopener\">official developer site<\/a>.<\/p>\n\n\n\n<p>WP-CLI comes with dozens of commands, but it\u2019s pretty easy to create a custom one. Read the&nbsp;<a href=\"https:\/\/make.wordpress.org\/cli\/handbook\/commands-cookbook\/\" target=\"_blank\" rel=\"noreferrer noopener\">commands cookbook<\/a>&nbsp;and&nbsp;<a href=\"https:\/\/make.wordpress.org\/cli\/handbook\/internal-api\/\" target=\"_blank\" rel=\"noreferrer noopener\">internal API docs<\/a>&nbsp;to discover a variety of helpful functions you can use in your custom WP-CLI command. WP-CLI supports registering any callable class, function, or closure as a command. It reads usage details from the callback\u2019s PHPdoc.&nbsp;<em>WP_CLI::add_command()<\/em>&nbsp;(<a href=\"https:\/\/make.wordpress.org\/cli\/handbook\/internal-api\/wp-cli-add-command\/\" target=\"_blank\" rel=\"noreferrer noopener\">doc<\/a>) is used for both internal and third-party command registration.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>To Recap<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"723\" src=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/dd7szZgViOb_l-OvGQQR5XCRUAn8Zrof-1024x723.jpg\" alt=\"\" class=\"wp-image-2200\" srcset=\"https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/dd7szZgViOb_l-OvGQQR5XCRUAn8Zrof-1024x723.jpg 1024w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/dd7szZgViOb_l-OvGQQR5XCRUAn8Zrof-150x106.jpg 150w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/dd7szZgViOb_l-OvGQQR5XCRUAn8Zrof-300x212.jpg 300w, https:\/\/alternative-spaces.com\/blog\/wp-content\/uploads\/2019\/08\/dd7szZgViOb_l-OvGQQR5XCRUAn8Zrof-768x542.jpg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>The WordPress Command Line Interface is a powerful, versatile, convenient, and developer-friendly tool that helps improve productivity during&nbsp;<a href=\"https:\/\/alternative-spaces.com\/blog\/cheap-wordpress-web-development-myth-or-reality\">WordPress web development<\/a>.&nbsp;<\/p>\n\n\n\n<p>The benefits of the WP-CLI are numerous. Start with the ability to interact with your WordPress installation on your server from the command line. WordPress platform has made it quite simple to install and manage the plugins, but for those who are used to the command line, the WP-CLI tool is just perfect. WP-CLI commands empower the developers to update WordPress core, set the necessary initial settings for the site, install, activate, deactivate, and update themes and plugins, and manage the users\u2019 access to the website, their posts, and comments quickly and conveniently. Developers can quickly create test sites, add test content, perform database search-replace operations, and do every kind of import\/export magic. They can configure multisite installations and much more without using a web browser.<\/p>\n\n\n\n<p>WP-CLI is efficient for managing your WordPress-based properties and could be ideal if you\u2019re running multiple sites on the same server. Site managers can handle site updates and other tasks for multiple sites with single commands.<\/p>\n\n\n\n<p>If you need any assistance with a WordPress site,\u00a0<a href=\"https:\/\/alternative-spaces.com\/\">contact<\/a>\u00a0our expert team!<\/p>\n\n\n\n<p>Content created by our partner, Onix-systems.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Web developers are widely using command line interfaces (CLI) to perform tasks more efficiently, configure their machine, or access features not available through a graphical user interface (GUI). Since we haven\u2019t written about one of Alternative-spaces&#8217;&nbsp;favorite technologies&nbsp;for a while, we dedicate this post to the WordPress console interface. Although the platform has made comment management, [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":2174,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2173","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/alternative-spaces.com\/blog\/wp-json\/wp\/v2\/posts\/2173","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alternative-spaces.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alternative-spaces.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alternative-spaces.com\/blog\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/alternative-spaces.com\/blog\/wp-json\/wp\/v2\/comments?post=2173"}],"version-history":[{"count":3,"href":"https:\/\/alternative-spaces.com\/blog\/wp-json\/wp\/v2\/posts\/2173\/revisions"}],"predecessor-version":[{"id":2542,"href":"https:\/\/alternative-spaces.com\/blog\/wp-json\/wp\/v2\/posts\/2173\/revisions\/2542"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/alternative-spaces.com\/blog\/wp-json\/wp\/v2\/media\/2174"}],"wp:attachment":[{"href":"https:\/\/alternative-spaces.com\/blog\/wp-json\/wp\/v2\/media?parent=2173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alternative-spaces.com\/blog\/wp-json\/wp\/v2\/categories?post=2173"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alternative-spaces.com\/blog\/wp-json\/wp\/v2\/tags?post=2173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}