How To Change WordPress Theme From The Database

Do you want to know how to change WordPress theme from the database? With having the little knowledge about handling database GUI tool, you can easily change 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 their WordPress version to the latest release. On WordPress site, we use premium or free theme developed by the theme author. It can happen that, the theme you are using are not compatible with the latest WordPress release and vice-versa. In such 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 white death screen for your site. In such case, you must have to change your theme or you will loose the traffic.

Change WordPress Theme From The Database

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

At 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 ‘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 the see the 2 rows. These are the option values WordPress store 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 active theme Twentyfifteen. If you observe under 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 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 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.