If a broken WordPress theme stops you from accessing the WordPress dashboard, you can change the active theme directly in the database.
This should only be used as a recovery method. If you can still access WordPress, change the theme from Appearance > Themes instead.
Before you start, take a database backup.
- Open phpMyAdmin from your hosting control panel.
- Select the database used by your WordPress site.
- Open the table ending in
_options. - Find the rows named
templateandstylesheet. - Edit the
option_valuefortemplate. - Enter the folder name of an installed theme.
- Save the change.
- Edit the
option_valueforstylesheet. - Enter the same theme folder name, unless you are activating a child theme.
- Save the change.
The theme name must match a folder that already exists in /wp-content/themes/. For recovery, it is usually best to switch to a default WordPress theme that is already installed.
The database table prefix may not be wp_. If your site uses a custom table prefix, look for the table that ends in _options.
After saving the change, reload your website and try to log in to WordPress again.