Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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 :-)

share|improve this question

2 Answers 2

up vote 2 down vote accepted

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.

share|improve this answer

DELETE FROM $wpdb->options WHERE option_name LIKE 'mytheme%'

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.