Red Science
Red Science

Reputation: 140

How to change the active wordpress theme using MySQL command line?

I would like to change my WordPress theme from the terminal in mysql, here I can see columns from table name with below code:

SELECT option_name FROM wp_options;

now I can see column: template

I would like to see template column details and in the next step change template value

I tested over and over like these commands without getting a result:

update option_name SET template where option_name='template';
UPDATE wp_options SET option_name WHERE template='<TEMPLATE_NAME>';

How can I resolve my problem?

Upvotes: 1

Views: 1158

Answers (1)

Kristian Vitozev
Kristian Vitozev

Reputation: 5971

You should update the following options (not only template option):

UPDATE wp_options SET option_value = '<your-new-theme>' WHERE option_name = 'template';
UPDATE wp_options SET option_value = '<your-new-theme>' WHERE option_name = 'stylesheet';
UPDATE wp_options SET option_value = '<your-new-theme>' WHERE option_name = 'current_theme';

After executing these queries, you should see the new theme activated.

N.B.: If you're using any caching plugin, try to purge the cache after running the queries above.


Upvotes: 1

Related Questions