How to Change WordPress Themes From the Database

How to Change WordPress Themes From the Database

Sometimes it becomes necessary to manually change your theme directly from the database instead of via the WordPress admin. This is actually what we use when upgrading our admin demos since it’s much faster using the command prompt or phpMyAdmin

Some times when we change or install new theme in our WordPress site or blog. We are getting error and our site is down due to new themes installation. if we change current selected theme to any other theme then our site is working. at this situation we don’t access our front end and back end. So we have only one method to change active theme from database.

To change current active theme There are three option_name in the database that need to be changed. That is control which theme is currently active on your website.

template The Theme Name as defined in style.cssstylesheet Name of your styleSheet, which is same as theme namecurrent_theme Name of your theme folder

Step 1: To change the above required details or column value we need to write a SQL query. Access your site database from PhpMyAdmin or command base and write a query.

1

2

3

4

5

SELECT *

FROM wp_options

WHERE option_name='template'

ORoption_name='stylesheet'

ORoption_name='current_theme';

Change the table prefix which are using in your database setting. like we are using wp_tablename

when we run above query in in PhpMyaAdmin we are getting there record as a response data from execution of the sql query. Below is the response data image.

Step 2: Now we update thse record from over new theme which we want to use(priviously working). Like we are change from the wordpress default theme “twentyfifteen”.