How to Change WordPress Themes From the Database or phpmyadmin

Sometimes it’s necessary to change your theme manually from the database instead of the WordPress admin.
This is depend on which you are using the database admin demos since it’s faster using the command prompt or phpMyAdmin.There are three option_name rows in the database which you need to be changed. These are what control which theme is currently active on your website.
template – the “Theme Name” as defined in style.css
stylesheet – the actual name of your theme folder
current_theme -the actual name of your theme folder
Stage 1 :First you do a quick check and see what theme you currently have set. Note, this SQL assumes you have your tables named with the standard wp_ prefix. If that is not the case, you’ll need to change wp_options to whatever prefix your table structure uses.

SELECT * FROM wp_options WHERE option_name = ‘template’ OR option_name = ‘stylesheet’ OR option_name = ‘current_theme’;

After running the SQL from within phpMyAdmin, you should see something like this:

Stage 2 :

Now You can proceed to change the theme. Short out which one you would like to switch to and change the three option_values = ”  below.

Once you’ve got your SQL code you’ll run it to change your current theme. (this example assumes you have ClassiPress already in /wp-content/themes/classipress/.

You will notice that the first option is capitalized which is important.

UPDATE wp_options SET option_value = ‘Atahualpa’ WHERE option_name = ‘template’;
UPDATE wp_options SET option_value = ‘atahualpa’ WHERE option_name = ‘stylesheet’;
UPDATE wp_options SET option_value = ‘atahualpa’ WHERE option_name = ‘current_theme’;

After running that SQL from within phpMyAdmin, you should see a success message similar to this:

Stage 3 :

Now you can check your website or refresh your site and you should now see the new theme running.

Bookmark the permalink.

Comments are closed.