Introducing Tutorial of WordPress Management with WP-CLI

Advanced 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:

1

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:

2

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

3

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

4

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:

5

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:

7

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

8

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:

9

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

10

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:

11