How To Change A WordPress Theme From The Database

Every WordPress site uses a database. The database is the DNA of the WordPress site and is responsible for displaying posts, images, storing user information and connects every element to the front end. You can add users, delete users and even change the administrative password right from the database. The first thing you should see when you visit the URL after installing WordPress is a setup guide asking for database information.

It’s highly advised that you stay away from any kind of database manipulation if you don’t know what you’re doing. If you have a theme that you’d like to switch it to something else, we’ll cover how to change it from the database in a few simple steps.

Here’s what you’ll need:

– The administrative username and password used to access the backend of the site (commonly cPanel).
– The database name, username and password for the site you’re going to be changing information on. This must be done from a username that has been given privileges to edit the database.
– The name of the theme you’re switching to. If for example, the name of the theme in the wp-content/themes folder is ‘mynewtheme’ then you’ll need to implement ‘mynewtheme’ into a field later.

If the theme you’d like to switch to isn’t currently installed, you’ll need to do that before accessing the database.

Access cPanel
Log into your hosting account (if the current hosting company has provided a backend) and open your cPanel

You can also go to http://www.yoururl.com:2082 or http://www.yoururl.com/cpanel

A list of services and site management tools should be present.

cpanel

PhpMyAdmin
Make sure you have the following information handy: Database name, username and password. Find the service named PhpMyAdmin in the Databases panel and click on it. This should open up a new window that will ask for login information.

Tip: If you’re unsure of which database is used for the site you’re editing, click on ‘File Manager’ from the cPanel interface. From there, navigate to your WordPress site’s root folder. You should see a list of files such as wp-config.php, index.php and a few folders that contain wp-content, wp-includes and wp-admin. Open up the wp-config.php file by right clicking and hitting view or edit if something needs changed. This will show you a few strings

define(‘DB_NAME’, ‘name’);
define(‘DB_USER’, ‘user’);
define(‘DB_PASSWORD’, ‘password’);

Once you’re logged in, there will be a list of database names. Click on the database that belongs to your website and a list under that database name should populate.

phpmyadmin

By default, WordPress will give the database a prefix of WP, so everything should have wp_ in front of it. However, if you gave your database another prefix during setup, it will have that prefix in front of every table rather than wp_.

Click on the following: wp_options and this will populate new information in the middle of the screen.

options

At the top of your screen, there will be a menu and from there, you need to click Browse. If there’s an option to ‘show all’, click on that. If there’s not an option to ‘show all’, we’ll need to navigate to the string we’re looking for.

We’re looking for ‘template’ and ‘stylesheet’. Both of these values need to be changed. When you find these values, check them both and select ‘change’ at the bottom.

option value

Finally, change the text in ‘option_value’ from the name of the current theme to the theme you’d like to have. Click on ‘go’ at the bottom of the page and your theme has successfully been changed via the database.

To get 2 months free WordPress Hosting

Fill up the following form and we will send the coupon code and order link within 5 minutes to your email.

Want to Try our Premium Wordpress Hosting?Its Absolutely Free for First 2 months!