How To Change WordPress Theme From The Database

Do you want to know how to change WordPress theme from the database? With a little knowledge about handling database GUI tools, you can easily change the WordPress theme without login to the dashboard.

Why You Need to Change Theme From Database

WordPress software regularly releases new updates. Each WordPress site should update its WordPress version to the latest release. On the WordPress site, we use premium or free themes developed by the theme author. It can happen that, the theme you are using is not compatible with the latest WordPress release and vice-versa. In such a case, there is a possibility that you are seeing some strange behavior on a site like you are now not able to access your dashboard, you are seeing a white death screen for your site. In such case, you must have to change your theme or you will lose the traffic.

Change WordPress Theme From The Database

To change the theme from the database, you should know a little about how to handle phpMyAdmin. Below are the steps for it.

First, open phpMyAdmin in your favorite browser. Next, go to the table {yourtableprefix}_options.

Click on ‘Search’ from the second top heading line.

change WordPress theme from the database step1

Select ‘IN(…)’ from the operator drop-down of option_name. In the ‘Value’ field type stylesheet,template. Press the ‘Go’ button.

change WordPress theme from the database step2

Alternatively, you can run the below query which also returns the same result.

SELECT * FROM {yourtableprefix}_options WHERE option_name IN ('stylesheet','template');

You will then see the 2 rows. These are the option values WordPress stores in the database when we activate the theme from the Dashboard. These values are the name of your theme folder. Now to change the theme run the update query. For instance, let’s say I want to set an active theme Twentyfifteen. If you observe under the themes directory, the folder name for theme Twentyfifteen is ‘twentyfifteen’. So our update query will be as follows. For simplicity, I pass values ‘39,40’ in the query. Change these values as per your ‘option_id’ from the last steps.

UPDATE {yourtableprefix}_options SET option_value = 'twentyfifteen' WHERE option_id IN (39, 40); //replace option id values with your ids

That’s it! I hope you learned how to change the WordPress theme from the database. For any questions or suggestions please leave a comment below.

If you liked this article, then please subscribe to our YouTube Channel for video tutorials.

Leave a Reply

Your email address will not be published. Required fields are marked *