Changing theme manually via the database

In this article, we will explain how to manually change the active theme of a WordPress website via the database. This is not a difficult task, however, you are working directly in the database. Some attention to where you click and making a backup of the database is highly recommended for this reason.

There are a number of situations where it is sometimes necessary to change the WordPress theme manually. The most common reason is that the active theme is too outdated, or on the other hand, causes a critical error in the website that prevents you from even logging into the administrator environment. Even restoring a full backup of the website here sometimes cannot make your website work properly again.

However, WordPress has a number of themes installed by default that you can use in case of emergency. These refer to the year they were released.

Step 1, Write down your database user and password

First step to manually changing your WordPress theme is to find out exactly what database and credentials you use to store your WordPress website. If you don't know this data, you can always navigate in the file manager to the wp-config.php file in the wwwroot. It contains your database data.

Paste this data into a notepad in your PC, and make sure you do not include any strange characters.

Step 2, Check which themes you have in the wp-content folder

The next step is to check which themes you have in the wp-content folder, you can check this again by going to the wwwroot in the filemanager, or by doing this via FTP with FileZilla. In the wwwroot folder you can then navigate to wp-content and then to the themes folder. You will then see an overview of the themes you have installed. In most cases we recommend switching back to a default theme from WordPress itself. Write down the name as it is shown here and save it again in notepad.

Changing theme manually via the database

Step 3, Change the active theme in the database

Then, to change the actual theme in the database, go to your database's PHPmyAdmin environment. Which can be accessed via the following link:

https://www.mysqlwebadmin.nl/

And here login to the appropriate MySQL server, using the data you noted down earlier in your notepad.

After logging in, navigate to the _options table, where you can change the theme.

Changing theme manually via the database


At the bottom, you can expand the table in its entirety (the warning is to accept the size of the fields for a moment), and then search for the next two fields.

Changing theme manually via the database

You can make this search easier on yourself by just pressing CTRL + F in your browser, and entering template or stylesheet in this search field. You'll come straight to it. Write down the exact name of the current theme in your notepad. Then you can easily go back if necessary.

Changing theme manually via the database


Both can be edited by pressing Edit, and then entering the name of your other theme in the next field.

Changing theme manually via the database


After this press Go, and repeat the step for the second field.

Changing theme manually via the database


After this, it is immediately changed and active.

Step 4, Check the website for functionality

The step that follows is to check your website for operation after this, many parts that you had specifically set up with your theme will unfortunately no longer be active. But you should be able to log back in within the WordPress administrator environment. You can then continue debugging, or switch to another theme that more closely matches your needs.

This way, you can often still save a website that you may have already written off in its entirety, and ensure that all your hard work is not lost.

As always, we recommend making regular backups of your website and checking and keeping this in order every month, for example. Even if you only update your website a few times a year. That little effort can keep your website working optimally, and prevent you from having to perform these steps from this article.

If you insist on keeping the theme that is causing the problems, you can contact its creators and specify the problems with it. They should then be able to help you update the theme.

If you would like further help with this, you can submit a ticket to the helpdesk. In most cases there are additional costs involved, which are always mentioned before they are charged. This is because we also spend the necessary labor on this.