How to change WordPress theme via mysql command line

Checking current theme:

select * from wp_options where option_name = ‘template’ or option_name = ‘stylesheet’ or option_name = ‘current_theme’;

You will see something like this

+———–+—————+————–+———-+
| option_id | option_name   | option_value | autoload |
+———–+—————+————–+———-+
|       149 | current_theme | themename    | yes      |
|        45 | stylesheet    | themename        | yes      |
|        44 | template      | themename        | yes      |
+———–+—————+————–+———-+
3 rows in set (0.00 sec)

Changing current theme ‘themename‘ to ‘twentyeleven

update wp_options set option_value = ‘twentyeleven’ where option_name = ‘template’;
update wp_options set option_value = ‘twentyeleven’ where option_name = ‘stylesheet’;
update wp_options set option_value = ‘twentyeleven’ where option_name = ‘current_theme’;

Enjoy

Leave a Reply

Този сайт използва Akismet за намаляване на спама. Научете как се обработват данните ви за коментари.