When the current theme breaks or has a problem, it can make the entire site inaccessible with errors. This makes it hard to switch to a working theme because even the admin panel won't load.
There are two ways to change the theme when you don't have the ability to log into your site:
- Using the command line
- Changing the theme in the database (using phpMyAdmin)
Using the command line
- Connect to your server via SSH and use the WordPress command line tool.
- Type the following to view a list of all available themes:
[server]$ wp theme status
- Type the following to change your theme:
[server]$ wp theme activate twentyfifteen
- If you don't have twentyfifteen, install and activate it in one command:
[server]$ wp theme install twentyfifteen --activate
Changing the theme in the database
To switch to a different theme using the database:
- Log into phpMyAdmin.
- Click your database name on the left.
- Find the _options table in the left column (the table name has a prefix but ends with "_options")
- Go to the second page and look for the options with the names template and stylesheet.
- Click the pencil icon to the left of each.
- In the large text field, you can see the current theme name:
- Change this to any theme you wish your site to use.
- Click the Go button when finished to save your changes.