How to Change WordPress Theme by Editing Database?

Last modified: June 17, 2020
You are here:
Estimated reading time: 1 min

Normally we change a WordPress theme from our WordPress dashboard. Inn some cases, updating a plugin is not compatible with our current theme, so we need to switch our WordPress theme. In such situations the only way to change the theme is manually from the database.

 

Steps to change the WordPress theme within phpMyAdmin

1) Log into cPanel.

2) Navigate to FileManager under ‘Files’ section.

Change Theme

 

3) Open ‘wp-config.php’ file and check the database name.

Change Theme

 

4) Navigate to phpMyAdmin under ‘Databases’ and open the database for the WordPress site.

5) Open wp-options table from the database.

change WordPress theme

 

6) Locate and open two rows called the template and the stylesheet.

Change Theme

 

7) Open both template and the stylesheet. Then replace the current theme by adding the new theme in option_value.

Change Theme

 

8) Click “Go” to enable changes.

 

You can change the WordPress theme by the terminal using the following steps.

1)  Login to the server using SSH command.

2) Upload the theme in the theme folder.

3) Login to MySQL using the below command.

# mysql -u root -p

4) Switch to website database

5) Check the current theme which is used in WordPress site using the following command.

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

6) Now update the WordPress theme using the bellow command.

UPDATE wp_options SET option_value = ‘Themename’ WHERE option_name = ‘template’;

 

If you need any further help please contact our support department.

Was this article helpful?
Dislike 0
Views: 12