To Update, Install & Remove WordPress Plugins & Themes With WP-CLI

WordPress was primarily a tool to create a blog, rather than more traditional websites. That hasn’t been true for a long time, though. Nowadays, thanks to changes to the core code, as well as WordPress’ massive ecosystem of plugins and themes, you can create any type of website with WordPress.

WP-CLI (WordPress Command Line Interface) provides a convenient way to manage your WordPress website through the command line while keeping your connection encrypted via SSH. This ensures the security of your website management tasks. If you’re familiar with connecting to your website via SSH and have already installed WP-CLI, you’re ready to get started.

To update, install, and remove WordPress plugins and themes using WP-CLI (WordPress Command Line Interface), you can follow the instructions below:

STEP 1 – Install WP-CLI:

If you haven’t installed WP-CLI yet, you can follow the official installation guide at: https://wp-cli.org/#installing

STEP 2 – Open your command-line interface:

Launch your preferred command-line interface such as Terminal (for Mac/Linux) or Command Prompt (for Windows).

STEP 3 – Navigate to your WordPress root directory:

Use the cd command to navigate to the root directory of your WordPress installation. For example, if your WordPress site is installed in the “public_html” folder, you can use the following command:

For Updating Plugins:

wp plugin update --all

If you want to update a specific plugin, use the following command, replacing “plugin-slug” with the actual slug of the plugin:

wp plugin update plugin-slug

To install a plugin, use the following command, replacing “plugin-slug” with the actual slug of the plugin:

wp plugin install plugin-slug

To remove a plugin, use the following command, replacing “plugin-slug” with the actual slug of the plugin:

wp plugin uninstall plugin-slug

For Updating Themes:

To update all themes, use the following command:

wp theme update --all

If you want to update a specific theme, use the following command, replacing “theme-slug” with the actual slug of the theme:

wp theme update theme-slug

To install a theme, use the following command, replacing “theme-slug” with the actual slug of the theme:

wp theme install theme-slug

To remove a theme, use the following command, replacing “theme-slug” with the actual slug of the theme:

wp theme delete theme-slug

SUMMARY

You can use these commands to update, install, and remove WordPress plugins and themes using WP-CLI. Make sure to replace “plugin-slug” and “theme-slug” with the actual slugs of the plugins and themes you want to work with.

To begin, establish an SSH connection to your server using a command-line interface like Terminal (for Mac/Linux) or PuTTY (for Windows). Once connected, navigate to your WordPress root directory. Use the cd command to reach the directory where your WordPress installation is located, typically the “public_html” or “www” folder.

Please note that using SSH and WP-CLI requires some technical knowledge, and it’s essential to follow best practices to ensure the security of your website and server.