Sometimes an error can make your WordPress admin area inaccessible. In that case, you won’t be able to change the theme using the above method.
To recover your website, you need to restore it from backup, or you may troubleshoot the WordPress error causing the problem.
However, if you don’t have a backup, then you can change the theme manually with the help of phpMyAdmin.
This method allows you to inform WordPress which theme to use by changing the information in the database.
First, you need to connect to your website using an FTP client and go to the /wp-content/themes/ folder.
Here you’ll be able to see all the themes that are currently installed on your website. You can also install a WordPress theme via FTP if you don’t see it.
Next, you want to write down the folder name of the theme you want to use because you’ll need it later.
After that, you need to go to the cPanel of your WordPress hosting account. On this page, you will have to scroll down to the Databases section and then click on phpMyAdmin.
Once you are in phpMyAdmin, you’ll see a list of databases on the left side of the screen. Simply click on the database that you are using for your WordPress site.
Next, it’ll show you the list of tables in this database. You need to click on the “wp_options” table to open it.
Note: By default, WordPress use wp_ as the prefix for the table names. However, it’s possible to have a different database prefix, as shown in the above image.
Now you need to locate the template and stylesheet rows on the right panel.
Next, click on the Edit link present in the “template” row to open the editor.
Here you need to change the value in the option_value field to the theme name that you want to use. It’s usually the same as the folder name in /wp-content/themes/ folder that you copied earlier.
Once you’re done, click on the Go button to save the changes. Next, go ahead and repeat the same process for the “stylesheet” row.
After making changes to both the rows, you can go to your website to see the new theme in action.