Use WP-CLI to Install a Plugin in 5 Quick Steps
Bulletproof Backups for Your WordPress Website
Fortify your business continuity with foolproof WordPress backups. No data loss, no downtime — just secure, seamless operation.

Installing WordPress plugins can take up a lot of time. You have to log in, search for plugins, and click around through confusing menus to find the right one. It gets even slower if you manage many sites or need to update plugins often.
This is where WP-CLI makes things much easier. This command-line tool lets you control your WordPress site using simple commands in your terminal. You do not need to open your web browser or keep clicking buttons.
With WP-CLI, you can install and activate plugins with just a few lines of text. You type a command, hit Enter, and the plugin downloads and installs in seconds. This saves a lot of time, especially if you repeat the same tasks on many sites.
If you use WordPress a lot or want to handle plugins quickly, WP-CLI can make your life much easier. In this guide, you will learn how to install a plugin using WP-CLI, step by step.
TL;DR: WP-CLI lets you install and manage plugins quickly using simple commands. This saves time and makes site management easier. Before you begin, remember to backup your WordPress site before making any changes.
1. Find the plugin slug
Before you can install a plugin using WP-CLI, you need the plugin’s slug. The slug is a special name that tells WP-CLI exactly which plugin you want to install.
Every plugin on WordPress.org has its own slug. You can find it in the plugin’s web address. For example, the plugin Contact Form 7 has this URL: https://wordpress.org/plugins/contact-form-7/. Here, contact-form-7 is the slug.

If you want to install a different plugin, just look at its WordPress.org page. The text after /plugins/ in the URL is the slug. You will use this slug in your WP-CLI commands.
Knowing the correct slug makes plugin installation quick and easy. Always double-check the slug to avoid mistakes.
2. Connect to your site
Before you use WP-CLI, you need to connect to your WordPress site. The steps are a little different depending on where your site is hosted. Here’s how you can do it:
If WordPress is on your local computer
- Open your terminal (on Mac or Linux) or Command Prompt/PowerShell (on Windows).
- Use the
cd
command to go to your WordPress installation folder. For example:cd /path/to/your/wordpress/
- Make sure you are in the folder where WordPress is installed.
If WordPress is on a remote web host
- Most web hosts give you SSH access. This means you can connect to your server safely from your computer.
- Check your hosting control panel or ask your host for these details:
- Your SSH username
- The server address (hostname or IP)
- Your SSH password or your SSH key file
- Open your terminal. Connect to your server with this command:
ssh username@server_address
- Enter your password if asked, or load your SSH key if using key authentication.
- Once you’re connected, you must go to the WordPress root directory. This is where files like wp-config.php and folders like wp-content/ are stored.
- Use the cd command to change to the correct folder. For example:
cd public_html
orcd /home/username/www
- If you are not sure which is the root directory, check your host’s help section or ask their support team.

Make sure you are in the main WordPress folder before running WP-CLI commands. This helps you avoid errors.
Tip: WP-CLI is a powerful tool, but it can also be unforgiving if you make a mistake. If you enter the wrong command, you might break something important on your site. There is no undo button in the terminal, so errors can happen quickly.
It is also easy to forget that installing or updating a plugin, whether you use WP-CLI or the WordPress dashboard, can sometimes break your site. You may not notice problems until you visit the site and see that something is wrong. That is why safe plugin management is so important.
This is why you should take backups of your site before proceeding with the next steps. We recommend using BlogVault since it offers real-time backups, so you can restore your site if anything goes wrong. It also lets you update plugins safely and test changes on a staging site before making them live. This way, you can manage your plugins with confidence and keep your WordPress site safe.
3. Install the plugin
Now that you have found the plugin slug and connected to your site, it’s time to install the plugin.
To install a plugin from the official WordPress repository, use this command:
wp plugin install <plugin-slug>
For example, if you want to install Contact Form 7, type: wp plugin install contact-form-7
Remember, this command will only install the plugin. It will not activate it yet.
If you have a plugin as a zip file, you can install it, too. In that case, the command varies slightly:
wp plugin install /path/to/plugin.zip
For example, if the plugin file is in your Downloads folder, type: wp plugin install ~/Downloads/my-plugin.zip
This is helpful if you bought a plugin or built a custom one. With just one command, your plugin is installed and ready to be activated.
4. Activate the plugin
After installing a plugin, it will not work until you activate it. To activate it, enter the following command:
wp plugin activate <plugin-slug>
For example, to activate Contact Form 7, use: wp plugin activate contact-form-7
This command turns on the plugin. You can use this step after manual uploads or when you move your site to a new host.
Tip: You can also install and activate a plugin in one step. Just add --activate
to the install command:
For example: wp plugin install contact-form-7 --activate
This is a fast way to get your plugins running right after you install them.
5. Update the plugin
If you install a plugin from the WordPress repository, you usually get the latest version. But if you install a plugin from an old zip file, it might not be up to date.
Now, keeping your plugins up to date is important for your site’s security and performance. To update a plugin, use this command:
wp plugin update <plugin-slug>
For example, to update Contact Form 7, type: wp plugin update contact-form-7
This command checks for the latest version and updates your plugin. It is a quick way to make sure your plugins are always current.
WP-CLI install plugin—Troubleshooting common issues
Sometimes, installing a plugin with WP-CLI does not go as planned. Here are some common problems and how to fix them. Each one is easy to check and solve with a few simple steps.
“WP-CLI: Command Not Found”
This error means that either WP-CLI is not installed or your computer can’t find it. Make sure you have installed WP-CLI. Type wp --info
to check. If it does not work, add WP-CLI to your system’s PATH (for Windows systems) or reinstall WP-CLI.
“Error: This does not seem to be a WordPress install.”
This error means that you are not in your WordPress folder. Use the cd
command to go to the folder with your wp-config.php file before running WP-CLI commands.
Permissions errors (like “Permission denied”)
This error appears when you do not have the appropriate file permissions. Check permissions with the ls -l
command. Make sure your files belong to the user running your web server. Change ownership or permissions using chown
, chmod
, or add sudo
to your command if needed. Also, do not use root unless necessary.
“Could not create directory.” / “Installation failed, could not create directory.”
This error tells you that WordPress cannot write to the plugins folder. Change the plugin folder’s permissions with:
chmod -R 755 wp-content/plugins
chown -R correctuser:correctgroup wp-content/plugins
Replace “correctuser” with your web server or FTP user.
Plugin needs higher PHP version or other features
This simply means that the plugin needs a newer PHP version or a missing library. Check the plugin’s requirements. Use php -v
to see your PHP version. Upgrade PHP or add any needed extensions.

“Error: Plugin already installed.”
This is a pretty self-explanatory error. Now, if you want to update the plugin, use:
wp plugin update <plugin-slug>
Or, just activate it with:
wp plugin activate <plugin-slug>
HTTP, connection, or DNS errors
This means that your site server cannot reach WordPress.org. Make sure your server has internet access. Check your firewall and DNS settings. Try again or contact your host for help.
Out of memory errors
If the PHP memory is too low for plugin installation, this error may pop up. Fix this by editing your wp-config.php file and adding the following line:
define('WP_MEMORY_LIMIT', '256M');

You can also change the memory_limit in php.ini and restart the server.
“Error Establishing a Database Connection”
You cannot install a plugin on your site if you cannot reach the site database. Check the DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST values in the wp-config.php file. Make sure the database server is running.

File already exists error (when installing from a ZIP file)
This means the plugin’s folder already exists in wp-content/plugins. Delete the old folder only if you know it is safe. To do so, enter the following command:
rm -rf wp-content/plugins/plugin-slug
Then run the install command again.
Final thoughts
Using WP-CLI to install plugins saves you time and effort. You can skip the WordPress dashboard and get straight to work. Just a few quick commands, and your plugins are ready to use. This makes running your site much faster and easier.
Before you make any changes, always take a backup of your site. This keeps your data safe if anything goes wrong. A tool like BlogVault helps with this. It gives you real-time backups, stores your backups off-site, and lets you restore your site with one click. With BlogVault, your site stays safe, secure, and easy to recover.
FAQs
How to install plugins using WP-CLI?
To install plugins using WP-CLI, first connect to your WordPress site using the terminal or SSH. Go to your WordPress directory. Then use the command wp plugin install <plugin-slug>
, replacing <plugin-slug> with the name of the plugin you want to install. This downloads and installs the plugin to your site.
How do I activate a plugin using WP-CLI?
To activate a plugin using WP-CLI, go to your WordPress directory in the terminal. Then use the command wp plugin activate <plugin-slug>
, replacing <plugin-slug> with the name of the plugin you want to activate. This will turn on the plugin for your site.
How can I update a plugin using WP-CLI?
To update a plugin using WP-CLI, first go to your WordPress directory in the terminal. Then type the command wp plugin update <plugin-slug>
, replacing <plugin-slug> with the name of the plugin you want to update. This will update the plugin to its latest version.
What are the advantages of using WP-CLI for plugin management?
WP-CLI helps you manage plugins much faster by using simple commands in the terminal. You do not need to log in to the WordPress dashboard or click many buttons. It can save time, reduce mistakes, and make it easier to manage many sites. WP-CLI is useful for both beginners and advanced users.
Tags:
Share it:
You may also like

How to Use WP-CLI to Manage Cron Jobs
Running a WordPress site means there are tasks you want to happen automatically. Maybe you want to schedule posts, send out email updates, or clear out old files from your…

WordPress Database Error Deadlock Found When Trying to Get Lock: 7 Easy Solutions
WordPress sites are vital for countless online presences, relying heavily on databases to run efficiently. Sometimes, you might encounter the “WordPress database error deadlock found when trying to get lock”…

Use WP-CLI to Disable a Plugin in 4 Easy Steps
Sometimes, a WordPress plugin can cause trouble on your site. Maybe a new update breaks your layout. Maybe a feature suddenly stops working. Sometimes, you just need to turn off…
How do you update and backup your website?
Creating Backup and Updating website can be time consuming and error-prone. BlogVault will save you hours everyday while providing you complete peace of mind.

Updating Everything Manually?
But it’s too time consuming, complicated and stops you from achieving your full potential. You don’t want to put your business at risk with inefficient management.

Backup Your WordPress Site
Install the plugin on your website, let it sync and you’re done. Get automated, scheduled backups for your critical site data, and make sure your website never experiences downtime again.