Using WP-CLI on WordPress

Managing WordPress either as a beginner or a developer from the admin panel is straightforward. However, there is another way of managing a WordPress site which involves using the WordPress command-line interface or WP-CLI. This command-line tool lets website administrators manage websites using easy commands rather than navigating the admin panel. You can execute tasks like installing plugins, activating themes and updating WordPress.

The biggest benefit of WP-CLI is saving time when configuring WordPress websites and performing tasks not supported by the WordPress admin panel. For example, you can use a command to install multiple plugins on a WordPress multisite environment at once or generate bulk posts

How to Install the WP-CLI on Your WordPress Website

To install WP-CLI on your WordPress website, your environment must have the following specifications:

  • A UNIX-like environment (OS X, Linux, FreeBSD, Cygwin)
  • The latest version of PHP
  • WordPress latest version
  • A hosting account with SSH access.

Download the wp-cli.phar file to your root directory using this command :

curl -O

Using the command confirm that the file is working:

php wp-cli.phar --info

To use the wp command and move it to another directory, you need to make the file executable by using the command below

chmod +x wp-cli.phar

Use this command to move into the final location.

sudo mv wp-cli.phar /usr/local/bin/wp

The WP-CLI has now been successfully installed. This can be tested by running the command wp –info. The information about the version of the WP-CLI will be
displayed if everything works. Using the command-line tool, you can start working with your WordPress content and files.

You are now ready to use the WP-CLI tool to manage your site more efficiently.

Help Documentation to Access the List of WP-CLI Commands
Enter the following command to open the WP-CLI built-in documentation

wp help

To Check WP-CLI Version use the following command

wp cli version

To see more information about your server and WordPress configuration use this command:

wp –info

To update WP-CLI, use the following command: