Changing Your WordPress Theme from the Database

I wrote about changing your SiteURL and home page URL within your database if you’re working with a blank screen in WordPress, but I wanted to document what it looks like to change your WordPress theme from the database as well. I was working with users to set their site to the default WordPress themes if there was ever an error with the site. Say the theme was outdated and broke after an upgrade.

If your theme is wonky, you may see several different errors, a Critical Error in WordPress, an HTTP 500 Error, weird CSS on pages. If you have a Critical Error on your page or the HTTP 500 Error, you can also diagnose that within the error_log file within your cPanel. You may also lose access to your wp-admin dashboard to change the theme as well.

To start, you want to locate your database. This can be found within the wp-config.php file or within your Installatron instance for the site:

 

You’ll then want to navigate to PHPMyAdmin (I’m using cPanel in this instance).

 

Within the database, you’ll want to move to the wp_options table and locate the template and stylesheet. They typically are within the same lines as each other.

Next, you’ll want to locate the theme you’d like to change to. This is found in the wp-content/themes folder of the install. Any of the WordPress themes like twentytwentyone or twentytwentytwo will work. WordPress will default to these themes when working on an error.

 

Back in PHPMyAdmin, you can double click on the previous theme name and change it to the new theme.

Click out of the box and do the same for the template/stylesheet rows. Once changed your site should start to load again and you can begin to troubleshoot from there!

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.