[theme-reviewers] Theme Options and Functions

Otto otto at ottodestruct.com
Wed Oct 20 19:14:46 UTC 2010


On Wed, Oct 20, 2010 at 1:55 PM, Muhammad Khairul Syahir Abdul Hakim
<khairulsyahir at gmail.com> wrote:
> If a theme has already stored countless rows in the database for its
> options, what  do you think would be the best way to convert those to a
> serialised array without needing the existing theme users to re-enter all
> the options and saving them again? I'm thinking an sql update script which
> the theme users must run after they update the theme. In that case what
> would be the best way to notify the theme users that a database update is
> required? there's no way we can output some kind of msg at the wp admin core
> update screen after the update, is there?

No need for user interaction. Just have the code check for the
existence of the new single option you want it use, and if it doesn't
find it, then run some code to go grab the old options and build the
array from them if they exist, or build a default set of options if
they don't exist. After saving the array in your new single option,
delete the old options if they existed.

This solves upgrades and new installs in a single stroke.

-Otto


More information about the theme-reviewers mailing list