WP-CLI Installation and Usage Guide for WordPress Management via Command Line

WP-CLI is a powerful command-line interface specifically built for WordPress site management. Whether you maintain a single website or oversee dozens, WP-CLI provides a fast, scriptable way to handle updates, configurations, and common tasks without accessing the browser-based admin panel. It’s especially useful for developers and system administrators who prefer automation or need to manage sites remotely.

This walkthrough assumes you already have WordPress running on a standard LAMP (Linux, Apache, MySQL, PHP) server.

Step 1: Downloading and Setting Up WP-CLI

To begin managing WordPress with WP-CLI, first download the tool using the following commands:

cd ~
curl -k -L https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar > wp-cli.phar

To confirm the tool is functioning correctly, execute:

This should return PHP environment details.

Step 2: Adding Alias to .bashrc File

For easier command access, define an alias by editing the ~/.bashrc configuration file. Append this line to it:

alias wp="php /home/USERNAME/wp-cli.phar"

Apply the changes immediately by running:

Step 3: Executing WP-CLI Commands

To utilize WP-CLI, switch to the directory where your WordPress site is stored. You can now execute WP-CLI instructions within that directory. For example, use the command below to upgrade your WordPress installation:

To discover the complete list of available WP-CLI commands, consult the official WP-CLI documentation online.

Conclusion

WP-CLI significantly enhances the way developers and administrators interact with WordPress installations. By removing the need to navigate through the web-based admin dashboard, it empowers you to automate, script, and streamline routine maintenance and deployments. This not only saves time but also reduces the risk of human error.

Whether you’re applying core updates, installing plugins, or managing databases, WP-CLI can handle it all from the terminal. Once you’re comfortable with the basics, you’ll find endless ways to incorporate WP-CLI into your workflow. Explore the official documentation for advanced usage, or integrate it into scripts to supercharge your WordPress management strategy.

Source: vultr.com

Create a Free Account

Register now and get access to our Cloud Services.

Posts you might be interested in:

Moderne Hosting Services mit Cloud Server, Managed Server und skalierbarem Cloud Hosting für professionelle IT-Infrastrukturen

CI/CD with Cypress & GitHub Actions for React Apps

React, Tutorial
Automating CI/CD Pipelines with Cypress and GitHub Actions CI/CD pipelines simplify software delivery by automating code integration, validation, and deployment. Incorporating end-to-end (E2E) tests ensures that changes function as expected…