WP-CLI is a command-line tool that allows you to manage your WordPress site without requiring to log in to your admin dashboard. This guide explains how to update plugins and themes quickly and efficiently using WP-CLI commands.
Note: Always take a full website backup before performing theme or plugin updates using WP-CLI.
Steps:
Updating plugins with WP-CLI
- To begin updating plugins using WP-CLI, first view all the installed plugins along with their status and version using the following command:
wp plugin list
- Then select the plugin you wish to update and execute the code below:
wp plugin update plugin-slug
Replace “plugin-slug” with the plugin’s actual folder name.
Let’s take examples:wp plugin update contact-form-7
wp plugin update litespeed-cache
- However, if you want to update all plugins at a time, then execute:
wp plugin update –all
Updating themes with WP-CLI
- View all the installed themes and their versions, using:
wp theme list
- To update a single theme, run:
wp theme update theme-slug
Replace “theme-slug” with the name of the theme’s directory.
Let’s take examples:wp theme update hello-elementor
wp theme update twentytwentyfour
- Moreover, to update every installed theme, follow:
wp theme update –all
Verifying the updates
After completing the plugin or theme updates, verify that the changes were applied successfully by running the following commands:
wp plugin list wp theme list
Ensure that the version numbers reflect the latest releases and that no errors are reported.
Simulating updates using the –dry-run option
If you want to test the update process without making any actual changes, you can use the –dry-run flag. This allows you to check for potential issues before applying updates.
wp plugin update plugin-slug --dry-run
Replace plugin-slug with the appropriate plugin directory name.
As you can see from the steps above, updating WordPress themes and plugins is a straightforward process. If you require any additional assistance, our support team is available to help.
Want to speed up WP-CLI tasks? Learn How to Install WP-CLI on a cPanel server with autocomplete