Example of uninstaller routine to remove all custom theme options from wp_options

All of my theme’s custom options are preceeded with “mytheme_” + option.

For example, mytheme_color1, mytheme_color2, mytheme_body_font_color, etc…

I’d like to create a plugin that uninstalls all of the items in wp_options where the option is preceeded with “mytheme_”

If you have a reference or example, please share it. Thanks in advance 🙂

2 Answers
2

All of my theme’s custom options are preceeded with “mytheme_” + option.

Not safe enough. Use set_theme_mod(), get_theme_mod() and remove_theme_mod() instead. You’ll find these and more related functions in wp-includes/theme.php.

Leave a Comment