Resetting your theme

For those of us who need to know ways to tear things back from the brink.

Recently I made the heart-stopping mistake of activating a WordPress theme in spite of the fact that the previewer refused to preview it. This resulted in my blog becoming inaccessible. Duh.

What now?

“Use the database”, came a far off voice. And so I did.

Logged in and changed to operative database as with the user name and password in wp-options.php with mysql and then ran this query:

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

This gives the current setting of those parameters. To change them all I needed to do was this:

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

Initially my front page was missing its sidebar and all the widgets that had been there, but I got it back by going in and just re-saving one of the widget items.