A great feature of WordPress Hosting at InMotion is the WP-CLI, (WordPress Command Line Interface) that allows you to easily manage your WordPress site(s) via the command line. Among the many available commands in WP-CLI is the theme command. You can use it to manage your WordPress themes via an SSH session. This command is utilized to install, remove, update, and activate/deactivate a theme. In this guide, you will learn how to install and activate a WordPress theme using the WP-CLI theme command.
Install and Activate a Theme
- SSH into your server as the cPanel user that owns the website you would like to install the plugin on.
- Use the cd command to switch to the document root directory of your website.
Example: cd public_html/my_website
NOTE: Be sure to replace public_html/my_website with the actual path to the document root directory of your website. - There are multiple ways to obtain/install a theme. If you are unsure of which option to choose, we recommend expanding the Slug option to follow those instructions.Slug
- Run the search subcommand below to find the theme. Be sure to replace our example search term hestia with the name of the theme you are searching for:
wp theme search hestia
- Note the slug value that appears next to the theme you would like to install. You will use this as an option in the command to install and activate the theme you searched for.
The table below is an example of the output (search results) from running the command above:
Name Slug Rating Christmas Hestia christmas-hestia 0 Tiny Hestia tiny-hestia 0 Hestia hestia 94 - Run the following command replacing hestia with the slug value you found in your search:
wp theme install hestia –activate
Zip File- Download the theme’s ZIP file and upload it to your server. Be sure to upload just the ZIP file to the document root directory of your website.
- Run the following command, replacing hestia.1.1.56.zip with your theme’s actual file name:
wp theme install hestia.1.1.56.zip –activate
Download Link- Locate the URL to download the theme you wish to install.
- Run the following command, replacing https://downloads.wordpress.org/theme/hestia.1.1.56.zip with your theme’s actual download link:
wp theme install https://downloads.wordpress.org/theme/hestia.1.1.56.zip –activate
- Run the search subcommand below to find the theme. Be sure to replace our example search term hestia with the name of the theme you are searching for:
Congratulations! Now you know how to use WP-CLI to install a WordPress theme from the command line. Want to learn more about WP-CLI? Be sure to check out our WP-CLI Education Channel.