Introducing Tutorial of WordPress Management with WP-CLI

Create a code in your website by using command line interface has always been popular among developers, as it can lift up productivity and speed up the development process.  If you are already getting used to with graphical interface, you may feel a bit difficult in using command line to perform certain tasks. Therefore, we are going to prove that this statement is not all true, at least for WordPress tasks.

For a long time, a graphical user interface in WordPress has helped to make it the most popular content management system on the website development, as this command graphic is provided in every administrative task. However, in terms of productivity, working with the command line allows you to manage a lot of tasks more quickly and efficiently.

So, what WP-CLI is actually?

WP-CLI is a set of command-line tools that provide such functionality for managing WordPress websites. Therefore, in this tutorial, I’m going to describe how to run the common tasks in WP-CLI, by showing you several advanced commands, so you can quickly understand how to operate it.

Common Tasks

This article is intended to give you some basic usages of WP-CLI, let’s check some tasks that can be performed on the command line.

INSTALL A WORDPRESS WEBSITE
core is a basic of WP-CLI command, which offers a set of powerful tools for managing WordPress installations. The first step in setting up a new WordPress website is by downloading the package. Direct to the preference directory and type:

This will download the latest version of WordPress in English (en_US). Another version or language also can be downloaded by using the –version and –locale parameters. For example, to use the Greek localization and 4.2.2 version, you would type:

Once the download is finished, you can create the wp-config.php file using the core config command:

This command will use the arguments and create a wp-config.php file. Eventually, to install WordPress, apply the core install command:

UPDATE CORE

If you need an update for your WordPress installation, use the wp core update and wp core update-db subcommands to update the core files and the database (if the database needs to be updated). WordPress updates, especially security fixes, are important. To make them happen more quickly, use the core update command and (if needed) the core update-db command:

If you want to know the current version of your installation using core version:

Initially, updating in the command line might not seem more efficient than doing it from the dashboard, but if you’re maintaining multiple WordPress installations, but in order to save time and clicks, you can maintain multiple WordPress installations. You can create a script and update them all at once:

In any case, before any update process is recommended you need to backing up your database:

MANAGE PLUGINS

Managing plugins is a matter of a single command. For instance, plugin status returns information about installed plugins and their status- A means active, I means inactive and UA means update available-work like this:

Other plugin-related subcommands are install, activate,deactivate, update, delete and search, which can be used like in the following example:

MANAGES THEMES

You can use the same basic commands like you usually use to handle a website’s theme by just replacing plugin with theme. One noteworthy command is scaffold, which creates an empty child theme, making that process much shorter:

Mario: