> ## Documentation Index
> Fetch the complete documentation index at: https://kb.verpex.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to Use the WP-CLI to Manage Your WordPress Site

With the different commands available on WP-CLI, there is nothing that cannot be done via the command line. Find below a list of some actions that can be performed using commands.

**1. Install and Update WordPress**\
Downloading and installing WordPress on your site is the most fundamental task you can accomplish with WP-CLI

To download WordPress use this command:

```text theme={null}
wp core download
```

To refine the download further to the version you want use this command:

```text theme={null}
wp core download --locale=en-US
```

This command will download the English version of WordPress

Proceed to install WordPress using the install command:

```text theme={null}
wp core install --url=testing.com --title=Example --admin_user=supervisor --admin_password=strongpassword --admin_email=info@testing.com
```

**Note: Replace the default values with your credentials.**

Test the installation to confirm WordPress has been successfully installed using this command:

```text theme={null}
wp core version
```

Update to the latest version using this command:

```text theme={null}
wp core update
```

**2 . Manage Themes and Plugins**

There are different ways to manage themes and plugins using WP-CLI, let’s take a look at some of the basic options

**Managing Themes via WP-CLI**

To list installed themes use this command:

```text theme={null}
wp theme list
```

To list all inactive themes as a CSV list, use this command:

```text theme={null}
wp theme list --status=inactive --format=csv
```

To change an active theme to  twenty-twenty, use this command:

```text theme={null}
wp theme activate twenty twenty
```

To search for themes with Bootstrap support:

```text theme={null}
wp theme search bootstrap
```

Using this command, proceed to install and activate:

```text theme={null}
wp theme install the-bootstrap-blog --activate
```

To  enable a theme using Twenty twenty theme, use this command:

```text theme={null}
wp theme enable twenty twenty
```

To update themes use this command:

```text theme={null}
wp theme update --all
```

To list all currently installed plugins, use this command:

**Managing Plugins via WP-CLI**

To install and activate a plugin use this command:

```text theme={null}
wp plugin install litespeed-cache --activate
```

Run this command to update plugins:

***

```text theme={null}
wp plugin update --all
```

**Note that the –all parameter is used to update all installed plugins.**\
This can be changed to a specific plugin by replacing –all  with the plugin name.

Using the  litespeed-cache plugin, disable and uninstall  a plugin:

```text theme={null}
wp plugin deactivate  litespeed-cache –uninstall
```

To activate any inactive plugin, use this command:

```text theme={null}
wp plugin activate  litespeed-cache
```

To find WordPress cache plugins use the following command:

```text theme={null}
wp plugin search cache
```

To delete plugins use the wp plugin delete command:

```text theme={null}
wp plugin delete litespeed-cache
```

**3.  Create a Child Theme**

By using the scaffold command, you can generate a child theme that includes the functions.php and style.css files. We recommend that you do this if you want to make changes to an existing theme. When you use a child theme, any customization won’t be lost after new software updates.

To do this, you’ll simply need to specify the slug for the new child theme, and for the theme, you’re using as the ‘parent.’ In this example, we are  creating a child based on the Twenty Twenty theme, and we’re giving it the slug twenty-twenty-child:

```text theme={null}
wp scaffold child-theme twenty-twenty-child --parent_theme=twentytwenty
```

You will get a successful message that the child theme has been created.\
and find the child theme in the specified template.

**4. Moderate Comments**

With WP-CLI, you can quickly create, edit and delete comments making managing comments much easier. There are many comment subcommands you can use, but let’s look at some of the most basic options.

To add a new comment, use this command. This command will add a comment to a post with the post ID of 10, and state the author and contents:

```text theme={null}
wp comment create --comment_post_ID=10 --comment_content="This is my comment" --comment_author="author-name"
```

This command will return a table containing the comment ID and author name for all approved comments on the post with an ID of 5:

```text theme={null}
wp comment list --number=5 --status=approve --fields=ID,comment_author
```

To delete comments, specify the comment IDs individually, like this:

```text theme={null}
wp comment delete 46
```

To delete multiple comments using the force parameter, which permanently deletes comments instead of adding them to the trash bin:

```text theme={null}
wp comment delete 3 25 46 54 --force
```

Using WP-CLI commands you can work through your site’s comments

**5. Update the WP-CLI**

You should always make sure that WP-CLI is updated at all times.

To update WP-CLI run the following command:

```text theme={null}
wp cli update
```

If your version is updated, you will get a successful message confirming this, however, if you are running a version that is not updated, you will be prompted to accept the installation, selecting yes will get WP-CLI  updated

With a simple interface like WP-CLI you can perform functions unavailable in WordPress, complete multiple tasks using a single command and improve productivity,
