How to change wordpress theme directly from database?

I had some error in my new wp theme. When I enabled the new theme, I got a blank page. I was unable to access my wordpress blog both from frontend and backend (admin panel).

In this case, either I need to change/fix my theme’s code. But, what if I am not a coder?

The solution is to change the currently active theme from database.

Open phpMyAdmin, go to your wp database. Open wp_options table. Search for three option_nametemplate, stylesheet, and current_theme.

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

See the option_value fields from the search result. The option_value will be your theme name. Change option_value of the search result to ‘classic’ OR ‘default’. Classic and default are the default wordpress themes present at the time of wp installation.

UPDATE wp_options SET option_value = 'default' WHERE option_name = 'template';
 
UPDATE wp_options SET option_value = 'default' WHERE option_name = 'stylesheet';
 
UPDATE wp_options SET option_value = 'default' WHERE option_name = 'current_theme';

36 replys to How to change wordpress theme directly from database?

  1. Pingback: Design Gala
  2. ur information is more useful to me but 80 % i reach to success but remaining 20% creating problem can u sort out me frm this. i m not able to change d theme

  3. THANKS A WHOLE LOT!!! iT HAD FREACKED ME OUT!!! Figured it out and I am a COMPLETE newbie on pHp…but please refine the steps a bit for them to be clearer…like what tab to click…what to put where…like replacing the theme name to “classic” etc…I followed it but am sure a whole lot of other people will be stuck..trust me!
    Thanks again!

  4. Pingback: josoroma
  5. Pingback: moodleitandme
  6. Pingback: cube_ice
  7. Since WP 3.0, you have to set ‘twentyten’ instead of ‘default’ or ‘classic’. Otherwise this doesn’t work.

  8. Thanks man. This worked for me. I wasn’t sure if that was all the DB entries that needed to be changed, so after doing what you suggested, I activated a different theme to update the DB, then activated my theme again. Awesome. Thanks for sharing.

  9. Thanks very much, this was the one suggestion that allowed me to get back into my site’s Dashboard so I could change the theme back to one that I knew would work.

  10. Thanks.

    You can shorten the SQL select statement to this:

    SELECT * FROM `wp_options` WHERE option_name in (‘template’,’stylesheet’,’current_theme’)

    1. That’s the point of the article, Cara. Sometimes a theme gets so screwed up that you can’t even access the admin panel to activate a theme, so you have go to the backend database.

Leave a Reply

Your email address will not be published. Required fields are marked *