Install a Theme Using WP-CLI

Install a Theme Using WP-CLI Hero Image

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

  1. SSH into your server as the cPanel user that owns the website you would like to install the plugin on.
  2. Use the cd command to switch to the document root directory of your website.

    Example: cd public_html/my_website

  3. 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

    1. 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

    2. 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:

      NameSlugRating
      Christmas Hestiachristmas-hestia0
      Tiny Hestiatiny-hestia0
      Hestiahestia94
    3. Run the following command replacing hestia with the slug value you found in your search:

      wp theme install hestia –activate

    Zip File
    1. 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.
    2. 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
    1. Locate the URL to download the theme you wish to install.
    2. 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

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.

InMotion Hosting Contributor
InMotion Hosting Contributor Content Writer

InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!

More Articles by InMotion Hosting

Was this article helpful? Join the conversation!