WordPress offers an option to upgrade sites in multiple ways! You can upgrade directly within the WordPress dashboard and through the command line interface. This allows you to upgrade plugins, themes, and even core files. This guide will walk you through working with the command line interface as a WordPress Multisite Administrator to upgrade the network.
First, you'll want to make sure that you know your FTP credentials. You'll need to use this to connect to the account via SSH. This guide will help you connect to your account via SSH.
Within cPanel, you'll be able to access the Terminal, where you can run SSH commands as the user.
From the terminal, you'll see a
bash connection happen automatically.
Non cPanel Connection
Navigating to the WordPress Files
You can use the
cd command to move between directories or use the
--path=[path] flag to designate where the WordPress site lives on the server. It looks like this:
Once you're in the directory of the application, you can start the upgrades. To start, you can upgrade plugins, themes, and core files to WordPress within the directory. Keep reading to understand how to build out the command you want to run:
If you're running an upgrade to a plugin, you will start with the following command:
wp plugin update
This designates that you want to update a particular plugin. From there, you can add to the command to accomplish different tasks:
This will tell WordPress to update all plugins that require an update.
Add the name of the plugins you need to update. You can create a list of plugins using a comma
You can even designate which version you'd like to update. This is also handy for rolling back a plugin version if needed.
This will skip any plugin you would not like to update.
Like the plugins above, you can use the theme flag to start updating themes:
wp theme update
You can then build on the above command by using the following flags to update any or all themes installed on the site:
This will update all themes installed on the site.
This will update the particular theme you would like to update.
Exclude themes installed on the site from the update.
Designate a version number you need to use. Also helpful to roll back a version.
To upgrade the core of WordPress you'll start with the following command:
wp core update
This will update the core to the latest version by default. You can also add some additional flags to customize the update even further:
This will tell WordPress to update to the particular version.
Use this when you're rolling back a version of WordPress, this will force the particular version to update, even if the version is older than the currently installed version.
When working within a WordPress multisite, you'll want to make sure to use the network flag:
This gives the Network Administrator privileges to upgrade the site.
When you're ready, you'll copy and paste the full command into your Terminal window. Examples of the full command may look like this:
Making core WordPress updates-
wp --allow-network core update
Updating all WordPress plugins-
wp --allow-network plugin update --all
Updating the Twenty Twenty-Two WordPress Theme-
wp --allow-network theme update twentytwentytwo --version 1.1
And that's it! You're on your way to upgrading WordPress version through the command line!