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 change your site's theme using WP-CLI. This can be used to activate a new theme after installation or to restore functionality to your site after a theme update has caused it to stop working.
Related Articles
SSH into Shared Server
How to SSH into VPS or Dedicated Server
Find the Document Root of a Domain
Add a WordPress Theme
Change Theme
- 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. - Run the following command to display the currently installed themes
wp theme list
- Locate the theme you wish to activate and copy the slug from the name column
- Run the following command, replacing "slug" with the slug obtained in the previous step
wp theme activate slug
CAUTION: It is recommended that you create a backup of your database prior to making changes. This can be done using the following commandwp db export
Comments
0 comments
Article is closed for comments.