> ## 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 Install WordPress via WP-CLI

Installing WordPress with WP-CLI takes just a few commands. You need to follow the steps below to install WordPress via the WP-CLI interface.

Using the WordPress command-line interface Navigate to the public\_html folder to access and manage your website:

```text theme={null}
cd /home/username/public_html
```

Download the newest WordPress core version once you are in the public\_html directory:

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

Enter the wp-config create command to MySQL database credentials to WordPress:

```text theme={null}
wp config create --dbname=wordpress --dbuser=user --dbpass=password --dbhost=localhost --dbprefix=wp_
```

**NOTE: Replace the default values with your database details.**

To complete the WordPress installation use the wp core install command:

```text theme={null}
wp core install --url=yourdomain.com --title=Site_Title --admin_user=admin_username --admin_password=admin_password --admin_email=testing@email.com
```

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

After the installation is complete, you should see a successful message.

**How to Reinstall WordPress Core via WP-CLI**

Using  the same WordPress installation command to reinstall the core software, use the skip-content option to download WordPress without the default themes and plugins and the force option to overwrite the existing files.

```text theme={null}
wp core download --skip-content --force
```

**Manage Content via WP-CLI**\
This method  can be useful for tasks such as creating bulk posts that can’t be done on WordPress admin panel

To see the list of all posts, use this command:

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

To delete a post use this command:

```text theme={null}
wp post delete 1
```

To create a new post, use this command:

```text theme={null}
wp post create --post_status=publish --post_title="This Post Was Created With WP-CLI" --edit
```

This command will open the Vim text editor. Input the text editor's content, exit Vim by typing:wq then press Enter.

To generate 5 posts, enter this command:

```text theme={null}
wp post generate --count=5
```

To import all images from the images\_for\_site folder use this command:

```text theme={null}
wp media import images-for-site/*
```
