All Collections
Useful Tools and Tips
How To: Change your Wordpress theme (cPanel)
How To: Change your Wordpress theme (cPanel)

Use different ways, including WP Admin, phpMyAdmin, shell and WP-CLI to change your Wordpress theme.

Scott avatar
Written by Scott
Updated over a week ago

Wordpress themes can be changed in many different ways. Here, we are discussing how to change the theme via your Wordpress admin panel, phpMyAdmin, shell (with or without root access), as well as WP-CLI.

I. Using your Wordpress admin panel

The easiest and the most common method to change your Wordpress theme is to use the Wordpress admin panel. Simply enough... 

Step 1. Login to Wordpress admin panel
Step 2. Appearance >> Themes
Step 3. Select your new theme and activate it

II. Using phpMyAdmin

If your current theme is showing any issues, we may be unable to access the Wordpress admin page to change the theme. In this case we can change the theme via phpMyAdmin. Before starting, it's always a good idea to take a full backup of the database. 

  • First, identify the database name:

Step 1. Login to server either using FTP or cPanel
Step 2. Use FTP manager (we recommend FileZilla) or if on cPanel, look under the 'Files' section and select 'File Manager' 

Step 3. Select the folder where Wordpress is installed
Step 4. Select the file wp-config.php (Wordpress configuration file), right click and choose ‘view’. 

Step 5. Note the DB_NAME (this is the name of your database)

Step 6. Close File Manager and go to cPanel.  
Step 7. Take a full backup of the database using this article  

  • Change the theme by editing the options 'template, stylesheet and current_theme' in the database table wp_options. 

Step 1. Under ‘Database’ section select ‘phpMyadmin’ in cPanel

Step 2. Select the database from the left navigation and click the table wp_options (the table name changes with respect to the table prefix. In this case the table name is wpwx_options as the table prefix is wpwx_ )  

Step 3. We have to change the value template, stylesheet and current_theme. First we are going to edit ‘stylesheet’.

Step 4. Select stylesheet and click edit.


Step 5. Change the theme name and click 'Go' to save.
Step 6. Like this, you can change the options 'template and current_theme'. Please note that the theme name should be same.   

Now check the site for your theme change!

III. Using WP-CLI

WP-CLI is command line interface for wordpress. We can make many changes in a wordpress site using wp-cli facility, and is immensely useful for development and WP management.

WP-CLI is is available on all BigScoots servers. If not, you can install using the article

Follow the below steps to change the wordpress theme. 

Step 1. SSH to the account
Step 2. Enter the below commands in the location where the wordpress is installed.

 # wp theme list  
+-------------------------+-----------+--------+---------------+
| name                   | status     | update | version       |
+------------------------+------------+-----------+------------+
| twentyfifteen          | active     | none   | 2.5           |
| twentyfourteen         | inactive   | none   | 2.7           |
| twentynineteen         | inactive   | none   | 1.4           |
+------------------------+------------+--------+---------------+

We can see the 'active' theme here and for changing, use the below command.

 # wp theme activate twentyfourteen

Use the theme name instead of "twentyfourteen"

IV. Changing theme via Shell

If you have shell access to the account (with or without root), then you can change the wordpress theme via shell. If we are not sure about the database details, check your wp-config.php file. There we will get the DB_NAME, DB_USER and DB_PASSWORD, which refers to your database name, database user and database user password respectively. First of all take a full backup of the database, then...

Step 1. Login to the server
Step 2. Check the database name using the below command. 

# grep DB /home/user_name/public_html/wp-config.php 
define('DB_NAME', 'bb******5');
define('DB_USER', 'dd******3');
define('DB_PASSWORD', '$password$');

Step 3. Access MySQL console. 

 # mysql -u DB_USER –p     (replace DB_USER with the database user)

Step 4. Now it’ll be prompted for the password. Enter the DB_PASSWORD there.  
Step 5. Use the following commands one by one in the MySQL console:   

> SHOW DATABASES;

> USE DB_NAME;    (replace with the database name)

> SHOW TABLES;

> SELECT * FROM wp_options WHERE option_name = ‘template’ OR option_name = ‘stylesheet’ OR option_name = ‘current_theme’;          

(We are going to make changes in the table ‘wp_options’. Name of wp_options table will be changed as per table_prefix)
Step 6. Now you can see the current theme of the domain. Use the below command to change the theme.   

> UPDATE wp_options SET option_value = ‘twentyeleven’ WHERE option_name = ‘template’ or option_name = ‘stylesheet’ or option_name = ‘current_theme’;

(Replace twentyeleven with the theme you want to use)
​ 

That’s all! As always, if you have ANY questions what so ever, or would like assistance with any of the above steps, we're always very happy to dive in right away with any amount of assistance you may need! :)

Did this answer your question?