How to reset only the database entries for a specific theme?

I ran into a bug while modifying a WordPress theme. The bug is that on Firefox, the page is scrollable to extremely many pixels, even though the actual website content is the proper size.

I also tried deleting both the parent and child themes, reinstalled them using the original zip files, but it doesn’t work because the settings are actually saved in a database.

Read More

(I know this to be true because the custom color settings I chose reappear even after deleting and reinstalling the themes. If this is the case, does that mean the problem is not caused by my tampering with the CSS, but through a setting that is customizable from the WordPress customize interface?)

I haven’t been able to find the code I tampered with manually, so I want to reset the database without resetting ALL the database settings. I just want to reset the database for the theme I tampered with.

How to reset the database for only a given theme, not the entire database?

Related posts

Leave a Reply

1 comment

  1. Search for the following functions used in the theme:

    • add_option( 'option_name', $values );
    • update_option( 'option_name', $values );

    Then search the database for option_name and delete the entries. If you are lucky, the theme uses only one entry and saves everything inside an array ($values). But there are themes that save each value inside one option, something like:

    $values = array(
        'color' => '#fff', 
        'background' => '#000', 
        'etc' => 'something',
        // a hundred more options
    );
    $theme_prefix = 'superTheme_';
    foreach( $values as $value => $default ) {
        add_option( $theme_prefix . $value, $default );
    }