[wp-hackers] any way to clean after theme when it gets deleted?

Andrew Nacin wp at andrewnacin.com
Fri Jul 30 15:41:58 UTC 2010


On Fri, Jul 30, 2010 at 11:33 AM, esmi at quirm dot net <esmi at quirm.net>wrote:

> on 30/07/2010 15:38 Andrew Nacin said the following:
>
>  On Fri, Jul 30, 2010 at 10:32 AM, Davit Barbakadze <jayarjo at gmail.com
>> >wrote:
>>
>
>  theme_mod functions? what do they do?
>>>
>>
>  Rudimentary options storage for themes. Each theme's mods are stored in a
>> single DB option row in the form of mod_{$theme}.
>>
>
> <snip>
>
> It's the multiple single rows in the db that I'm not keen on. Most of the
> time, I've been using a single row in the options table to store a
> serialized array. Each theme then has a manual "reset" option which removes
> all stored theme options but, thus far, I haven't found a way to trigger the
> reset on theme deletion.
>

Sorry, to be clear, each theme has a single row which contains all mods for
that theme, serialized. You could use the same technique, coupled with
remove_theme_mods(); however, you wouldn't be able to take advantage of the
settings API out of the box.


More information about the wp-hackers mailing list