WP-CLI is a powerful command line utility for WordPress, which is included by default with your hosting plan or server. It can be used to perform many of the actions you would normally complete in the WordPress dashboard, such as installing or updating plugins and themes, managing users, making changes to the site configuration, and much more.
Here we cover the steps to install a plugin using WP-CLI.
Related Articles
SSH into Shared Server
Find the Document Root of a Domain
Install a WordPress Plugin
Install Plugin
- Access the server via SSH or using the Terminal in cPanel
- Navigate to the site's document root using the cd command
cd public_html
REPLACE: public_html with your domain's document root if different. See the guide on finding the document root of a domain for guidance. - There are multiple ways to obtain the plugin to install
- Install by slug or plugin name
- Perform a search for the plugin by running the following command
wp plugin search plugin_name
NOTE: Any plugin with more than one word in its name needs to be placed within double (") or single (') quotes. For example:wp plugin search "really simply ssl"
- Locate the name or slug of the plugin from the columns displayed
- Run the install command using the slug or name of the desired plugin
wp plugin install slug --activate
wp plugin install "Plugin Name" --activate
EXAMPLE:wp plugin install really-simple-ssl --activate
wp plugin install "Really Simple SSL" --activate
- Perform a search for the plugin by running the following command
-
Install by providing the path to the already downloaded zip file
-
Upload the zip file of the plugin to the website's document root
- Run the install command using the file path for the uploaded plugin.
EXAMPLE:
wp plugin install /home/user/public_html/really-simple-ssl.3.3.3.zip --activate
-
- Install with direct URL
EXAMPLE:
wp plugin install https://downloads.wordpress.org/plugin/really-simple-ssl.3.3.3.zip --activate
- Install by slug or plugin name
NOTE: The optional --activate
flag is used to activate the plugin upon installation, removing the need to activate it separately. If this was excluded you can use the following command to activate the plugin, replacing "slug" with the slug of the plugin you need to activate: wp plugin activate slug
.