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:
Download the newest WordPress core version once you are in the public_html directory:
Enter the wp-config create command to MySQL database credentials to WordPress:
NOTE: Replace the default values with your database details.
To complete the WordPress installation use the wp core install command:
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.
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:
To delete a post use this command:
To create a new post, use this command:
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:
To import all images from the images_for_site folder use this command: