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.
Getting Started
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.
cPanel Connection
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
If you're not using cPanel, you can access your account using an SSH Gateway. Use your preferred application, like Terminal or iTerm on MacOs and ssh.exe or PuTTY on Windows.
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:
--path=/home/meredith/public_html
Starting Upgrades
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:
Plugins
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:
-
--all
This will tell WordPress to update all plugins that require an update. -
--[plugin name…]
Add the name of the plugins you need to update. You can create a list of plugins using a comma -
--version=[version number]
You can even designate which version you'd like to update. This is also handy for rolling back a plugin version if needed. -
--skip-plugins=[plugins]
This will skip any plugin you would not like to update.
Themes
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:
-
--all
This will update all themes installed on the site. -
[theme name]…
This will update the particular theme you would like to update. -
--exclude=[theme-names]
Exclude themes installed on the site from the update. -
--version=[version]
Designate a version number you need to use. Also helpful to roll back a version.
WordPress Core
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:
-
--version=[version]
This will tell WordPress to update to the particular version. -
--force
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.
Network Calls
When working within a WordPress multisite, you'll want to make sure to use the network flag:
--network
Final command
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 core update --network
Updating all WordPress plugins-
wp plugin update --all --network
Updating the Twenty Twenty-Two WordPress Theme-
wp theme update twentytwentytwo --version 1.1 --network
Running database updates-
wp core update-db --network