User Tools

Site Tools


howto:wordpress_reset_theme

Reset a Theme in Wordpress (like it was a fresh install)

When you install a theme and edit it in Wordpress, this tries to be clever and remember all your customizations so if you reinstall the theme you will have them all there. But sometimes when you fresh install a theme all you want is the original theme (which you have probably hosed with your carefree editing). Before running the commands

These are the steps to reset a theme to its original state.

  1. Have a look at the wp-content/themes directory in your wordpress installation. Find the theme you want to reset/fresh install and take note of its name. I will use twentytwentythree in the rest of the instructions here.
  2. First of all login as admin, and go to AppearanceThemes, here select and activate some other theme (other than twentytwentythree). Then delete the twentytwentythree theme, by clicking on the Theme Details and clicking on Delete in the bottom right of the theme preview.
  3. We need to delete some of the customizations in the wp_options table. In the MySQL wordpress database: delete from wp_options where option_id in (select option_id from wp_options w where w.option_name like '%twentytwentythree%' or w.option_value like '%twentytwentythree%');
  4. Get the IDs of posts in wp_posts using select ID from wp_posts where post_type in ('wp_template_part', 'wp_template', 'customize_changeset') or post_content like '%twentytwentythree%';. Find the twentytwentythree related ones and delete those rows with a few well-aimed delete from wp_posts where ID = XXX; (replace XXX with the appropriate ID)
  5. Go back in AppearanceThemes and Add New the 'old' theme again (i.e. twentytwentythree)

You should now have a clean new theme, fresh and clean as a whistle.

howto/wordpress_reset_theme.txt · Last modified: 2023/05/08 19:26 by jp