What do you do when you face the notorious “white screen of death” on your WordPress installation? The standard advice in this situation is to change your WordPress theme or disable your plugins. But what if you can’t access even the admin area of your blog? Such problems are surprisingly common – and it rules out any kind of “normal” troubleshooting.
Which is why you need another mechanism – something by which you can change your WordPress theme directly in the database instead of through the admin area. And this tutorial will show you how to do exactly that. All you need is access to your cPanel backend. Let’s get started!
First, my current theme is called “Write” as shown here:
Step 1: Get the Folder Name of the New Theme
To change your old theme to a new one via the database, you need to have the new theme already installed (but not activated). Each WordPress theme resides in its own folder, and all the folders are located here:
To make the change, we need to get the exact folder name of the new theme. To do this, log into cPanel and open the file manager as shown here:
Now navigate to the above location and you should see a list of your themes:
The folder name is usually just a simplified version of the theme name, so you shouldn’t have much difficulty figuring out which one is which. Make a note of the new theme’s folder name. We’ll be using it later.
Step 2: Access phpMyAdmin and Open the Database
The easiest way to access a WordPress database is through cPanel, using the “phpMyAdmin” module as shown here:
Once inside, it’ll show you a list of databases on your current hosting account. If you have just one website, it’s the database that DOESN’T have then name “information_schema”. If you’re not sure what your database name is, follow the first step in this tutorial.
Click your database to focus and open it as shown here:
Step 3: Locate the Records in the “Options” Table
Once you’ve opened the database by clicking on it, find the name of the table that ends with “_options” as shown in the above screenshot. Every installation will have a unique prefix, so I can’t tell you in advance what it is. This is done for security reasons so that it’s not easy for a hacker to use a standardized command.
Navigate to the “SQL” tab on the right-hand side. This will open up a textarea into which you can write commands. Paste the following into it:
SELECT * FROM `[something_options]` WHERE `option_name`='template' OR `option_name` = 'stylesheet'
Replace [something_options] above with the name of the “options” table in your installation. Then click “Go” on the bottom right-hand side of the screen. This will locate two records in the options table as shown here:
Step 4: Change the Theme Name
For each “option_value” in the two records as shown above, double-click inside the fields and change the text inside to the new theme folder name that you got in Step 1. In this example, I’m changing the theme to “twentyfifteen” for the “Twenty Fifteen” folder name:
Press enter after changing the text and the records will be updated automatically. You’re done! Now you can verify that the theme has changed by going to the WordPress dashboard and clicking “Appearance”:
If your site was broken before due to a theme error, it should be working now. I hope this tutorial helped you recover from a broken installation!
I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!