Change your WordPress theme from the database

You updated your theme. Now you see a white screen. You can’t access WP Admin. Your site is locked.

When a theme breaks your site, you can’t simply switch it back from the dashboard, because you can’t log in.

The solution? Change the active theme directly from your database.

This guide shows you how, step by step.

1. When You Need This Method

This technique is useful when:

  • A theme update causes a white screen or fatal error
  • You’re locked out of /wp-admin
  • Your site shows a “Critical Error” message
  • You need to revert to a default theme to regain access

If you can still access the admin area, just switch themes normally. This method is only for when you cannot.

2. Step-by-Step Guide

Step 1: Access phpMyAdmin

Log into your hosting control panel (cPanel, Plesk, etc.) and open phpMyAdmin.

Don’t know how? Most hosts have a guide. Look for “Databases” → “phpMyAdmin” or contact support.

Step 2: Select Your Database and Open _options

In the left sidebar, click on your WordPress database. Then find and click the table that ends with _options.

The prefix may vary:

  • wp_options
  • wp2_options
  • hello_options (if your site is on a subdomain called “hello”)
  • Any other custom prefix

Tip: Use the search bar at the top of phpMyAdmin and search for options if you have many tables.

Step 3: Locate template and stylesheet

You need to find two rows in the _options table:

  • template
  • stylesheet

These rows control your active theme. They are usually on page 2 of the options table. Use the pagination controls at the bottom to navigate.

Alternatively: Click the Search tab, search for option_name = 'template', then repeat for stylesheet.

Step 4: Replace with a Default Theme

First, check which themes are installed on your server:

  • Open your hosting File Manager or connect via FTP
  • Navigate to /wp-content/themes/
  • Note the folder names of installed themes (e.g., twentytwentyfourtwentytwentythree)

Now edit the database:

  1. Click the Edit button (pencil icon) next to the template row.
  2. In the option_value field, replace the current theme name with a default WordPress theme that is installed on your server (e.g., twentytwentyfour).
  3. Click Go to save.
  4. Repeat the same process for the stylesheet row.

Important: Both template and stylesheet must be set to the same theme name (unless you’re using a child theme, in that case, template is the parent, stylesheet is the child).

Recommended default themes: twentytwentyfourtwentytwentythreetwentytwentytwo. These come with every WordPress installation.

If the default theme isn’t installed: Download it from WordPress.org, upload it via FTP to /wp-content/themes/, then follow the steps above.

Step 5: Done!

Visit your website. It should load normally again. Log into WP Admin, you’re back in control.

From there, you can:

  • Reactivate your original theme (if the issue is fixed)
  • Switch to a different theme
  • Troubleshoot the problem further

3. Troubleshooting

My site is still broken after changing the theme

The issue might not be your theme. Try disabling all plugins (see our guide on disabling plugins via phpMyAdmin).

I don’t see template and stylesheet rows

Search for them using the Search tab in phpMyAdmin. If they don’t exist, your database may have a different structure, contact your host.

I changed the theme but the admin area is still inaccessible

Clear your browser cache. Try a different browser or incognito mode. If that doesn’t work, the issue may be a plugin or a corrupted WordPress core file.

Can I switch to any theme?

Only to themes that are already installed in /wp-content/themes/. If your desired theme isn’t installed, upload it via FTP first.

Final Thoughts

A broken theme doesn’t have to lock you out of your site forever. By changing the active theme directly from the database, you can regain access in minutes.

Remember:

  • Always back up your database before making changes
  • Only switch to a theme that is already installed
  • Both template and stylesheet usually need the same value
  • If this doesn’t work, try disabling plugins next

Now you know how to rescue your site from a theme-related white screen, no panic required.

Was this post helpful?
Buy us a coffee!
Tags: