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.
- 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 usetwentytwentythree
in the rest of the instructions here. - First of all login as
admin
, and go toAppearance
→Themes
, here select and activate some other theme (other thantwentytwentythree
). Then delete thetwentytwentythree
theme, by clicking on the Theme Details and clicking on Delete in the bottom right of the theme preview. - 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%');
- Get the IDs of posts in
wp_posts
usingselect ID from wp_posts where post_type in ('wp_template_part', 'wp_template', 'customize_changeset') or post_content like '%twentytwentythree%';
. Find thetwentytwentythree
related ones and delete those rows with a few well-aimeddelete from wp_posts where ID = XXX;
(replace XXX with the appropriate ID) - Go back in
Appearance
→Themes
andAdd 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