Install a Theme Using WP-CLI

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. Click on one of the buttons below to expand the specific instructions for the method that works best for you. If you are unsure of which option to choose, we recommend expanding the Slug option to follow those instructions.

    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

    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

    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.

JB
John-Paul Briones

John-Paul is an Electronics Engineer that spent most of his career in IT. He has been a Technical Writer for InMotion since 2013.

More Articles by John-Paul

Was this article helpful? Let us know!