How to Change Your Active WordPress Theme Through Your Database

Posted on October 20, 2018 by in WordPress | 8 comments

How to Change Your Active WordPress Theme Through Your Database

Themes are one of WordPress’ main selling points. However, they can sometimes break, cause issues with plugins, or with other elements on your website. In those cases, you might need to change your active theme, but it could be difficult to do so if you don’t have access to your dashboard due to an error.

The good news is there are workarounds for this problem. You can, for example, change themes through the database in a matter of minutes, if you know where to look. In this article, we’ll talk about some situations where you might need to do this, and then we’ll guide you through the process in three steps.

Let’s get to it!

Subscribe To Our Youtube Channel

Why You Might Need to Disable Your Active WordPress Theme

Under normal circumstances, changing your WordPress theme only takes seconds. All you need to do is choosing which theme to use and activating it.

These days, a lot of themes try to outdo each other when it comes to features, to attract as wide a user base as possible. In a lot of cases, they use JavaScript or jQuery, which can sometimes lead to conflicts with some of your plugins. These conflicts can cause specific functionality to stop working or, if you’re really unlucky, they may leave you unable to access your site or dashboard at all.

In these cases, you’ll likely need to change your theme. The problem is, if you use FTP to disable your theme, WordPress won’t let you choose which theme to use instead and will automatically set one of the default themes. That’s why it can make more sense to change themes through the database instead. With this process, you have full control over which theme to enable.

Before you try this, we recommend you try to troubleshoot your plugins first, be it via FTP or your database. In our experience, it’s often easier to replace one troublesome plugin or two instead of switching themes altogether. However, your mileage may vary, so it doesn’t hurt to have this trick up your sleeve, just in case.

How to Change Your Active WordPress Theme Through Your Database (In 3 Steps)

Since we’re going to be making changes to your database (albeit small ones), it would be wise to create a backup of it just in case. That way, if something goes wrong, you can restore it via phpMyAdmin.

Step #1: Access Your WordPress Database With phpMyAdmin

We’ve covered this process in the past, so let’s keep it quick. If you’re using shared hosting, chances are your provider uses cPanel for your plan. In that case, you can access your WordPress database via phpMyAdmin by logging into your cPanel and finding that option under the Databases section:

Once you’re in, look for the database that corresponds to the website you want to troubleshoot. If you’re only hosting a single site on your plan, there should only be one option to the left. In the example below, you can see several databases. However, the next steps won’t change regardless of which site’s database you access, as long as it uses WordPress.

If you’re not using a shared plan, take a look at your hosting provider’s control panel. Most platforms will provide you with a way to access and edit your database, even if you don’t have cPanel set up.

Step #2: Find Where WordPress Stores Your Active Theme’s Value

WordPress stores all your website’s information in a single database, including which theme you’re using. Your job then is to find where that value resides in your database and change it.

Once you choose the database you want to edit, you’ll see a list of all the tables WordPress uses to store its data. The one we’re interested in is usually called wp_options:

Keep in mind – some hosting providers change your database and table prefixes from the default wp for security purposes, as in the example above. In any case, these changes don’t affect the way your database works. Moving on – click on the wp_options table and on the next page, tick the box that says Show all at the top of the screen:

What this does is display all the wp_options rows in the same page, so you can find the ones you’re looking for without jumping back and forth. Now, use your browser’s search function to find the template value under the option_name column:

You’ll notice we highlighted two rows in the screenshot above, both of which show twentyseventeen under option_value. To change your theme, we need to edit both rows. However, before we do that, you need to know what value to replace your current theme with, which brings us to the next section.

Step #3: Change Your Active Theme

All you need to do now is edit the values we showed you earlier under both the template and stylesheet rows. The problem is, you can’t just type the name of the theme you want to use.

If you type the theme’s full name, WordPress won’t know what you’re talking about, and you’ll run into an error. For example, take the Twenty Seventeen theme, which shows up as a single word, twentyseventeen. This is often not a problem with themes that have single-word names, such as Divi.

However, in some cases, you’ll need to do a little digging to find out which value to use on your database. There are a couple of ways to do this. If the theme you want to use is on the WordPress.org theme repository, you can find an option called Development Log under the Browse the Code section on its page:

If you click on this option, you’ll see a page showing the theme’s update record. At the top of the screen, you’ll see a subheading that says source, with the theme’s development name next to it:

In the example above, we check out the Clean Education theme, and found out it goes by the clean-education name. The latter is the value you’d want to use to enable it from your database. You can also find out this information by accessing your website via FTP and navigating to the public_html/wp-content/themes directory. Inside, you’ll find folders for each theme installed on your website:

Each folder’s name reflects how WordPress recognizes those themes. For example, if you wanted to switch to Divi using your database, you’d need to enter ‘divi’ as the value. Let’s go ahead and do that now. Return to your database and click on the Edit button to the left of the template row:

On the next screen, look for the option_value field and replace its contents with divi:

Now click on the Go button at the lower right of the page to save your changes. Repeat that exact same process for the stylesheet row within your wp_options table. Once you’ve updated both values, you can go ahead and access your website, which should now be using Divi.

Conclusion

If your WordPress theme is giving you problems, the easy fix is to temporarily disable it, which you’d usually do through your dashboard. If you can’t access the dashboard, you may need to use your database instead. This is a bit trickier, but it also enables you to specify which theme to use.

To use your database to change your active theme, you’ll need to follow these steps:

  1. Access your database using phpMyAdmin.
  2. Find where your database stores your theme’s value.
  3. Switch your active theme with another one of your choice.

Do you have any questions about how to change themes through the database? Let’s talk about them in the comments section below!

Article thumbnail image by ProStockStudio / shutterstock.com

Premade Layouts

Check Out These Related Posts

How to Use the WordPress Calendar Block

How to Use the WordPress Calendar Block

Posted on September 16, 2021 by in WordPress

Keeping your content organized is an important aspect of running a website. Fortunately, the WordPress Calendar block can help you do that. This element enables you to display a calendar on your site that links to your posts based on their publication dates. As such, your readers won’t need...

View Full Post
How to Use the WordPress Audio Block

How to Use the WordPress Audio Block

Posted on September 15, 2021 by in WordPress

The WordPress Audio Block lets you provide playable audio files within your pages and posts. The audio files can be added from your media library or a URL. Users can play the audio from their browsers or download them to listen offline. This is a great way to provide music, podcasts, or other types...

View Full Post
How to Use the WordPress Cover Block

How to Use the WordPress Cover Block

Posted on September 14, 2021 by in WordPress

The WordPress Cover Block is interesting. It lets you place an image, video, or solid color in the background and add content blocks to the foreground. This means you can place blocks over other blocks. It has more options than most blocks. Knowing how to use the Cover Block can greatly enhance the...

View Full Post

8 Comments

  1. This is a life-saving article. My website was giving an error while changing the theme and I was not able to access my WordPress admin area to change the theme. I have followed your entire guide fixed this problem through my CPanel area.

    • I’m really glad to hear it was useful! 🙂

  2. This is definitely a good trick to add to the arsenal! I usually just rename the active theme’s folder via ftp but this is way better being able to choose what it defaults to. Thanks for being so detailed about it, I think matching the theme’s exact folder name to the database value would’ve probably tripped me up!

    • FTP is usually a fine way of doing it, but it might not always be possible. I’m glad you enjoyed the article. 🙂

  3. Thanks for this Post.

    I’ve had to do a similar thing for the Active Plugins(much different update for the value of the ‘option_name’ for plugins).

    I did not know which values to look for in the ‘option_name’ field for the themes. And I would have forgotten to consider the StyleSheet, so thanks for the extra info.

    • You’re welcome, Greg! 🙂

  4. Management under folders with WP
    Hi, I try to explain, I’m trying to solve a passage that from what I could notice documenting penalizes the visibility of the site on Google with poor visibility, from 0 to 3 daily visits.
    The site laspesacasa.it offers the sale of typical products made with WordPress, for logistical reasons and not being able to manage the products I personally created sub-domains.
    So the site laspesacasa.it and the parent site and the various subdomains nomedelproduttore.laspesacasa.it are the producers who have different shipping and administration fees, all done with woocommerce.
    What I ask is possible to manage everything from the parent site (I do not know if it is the exact wording – tracking code). Example, laspesacasa.it/produttore and within the subfolders manage the woocommerce of the single producer with the different logistical and administrative needs.

    Can you help me, need a programmer’s intervention or are there other solutions?
    Thank you

  5. Does changing WordPress themes affect your website’s ranking on google?

Join To Download Today

Pin It on Pinterest