• How do you guys handle database changes, more specifically the settings (wp_options)?

    Im looking for something like, having a JSON file (or migration files bit similar like Laravel) with settings, that I can run after a deployment.

    For example once I install WooCommerce I have a list with default settings (presets) I want to use and import at once. But also once I add a new feature or plugin that I can migrate those settings across multiple environments.

    Would be cool if that JSON file (or settings file) is environment based. So I can use test payment method settings on local and live settings on production. And just run a command like wp migrate options or something in my deployment script, which sets all the correct settings for that environment.

    Is there something like that?

    Thanks in advance ??

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    My sites don’t have enough in common to be worth doing such a thing, but if they did, I think I’d just create custom get and set scripts just for the options I’m interested in. I suspect there would be more to this than just option values, so it’s unlikely there would be an existing scheme to meet such specific needs. If it’s just you using it, it needn’t be that complicated.

    Perhaps an array of option key names that your code loops through in constructing a data exchange file. JSON is a good choice. On the other end, parse through the file and set options accordingly. Contain it all in a custom plugin and Bob’s your uncle ??

    Thread Starter JohanvdMolen

    (@pixelive)

    Thanks @bcworkz.

    Exactly what I thought, but I thought maybe something like that had already been made. ??

    • This reply was modified 5 years, 3 months ago by JohanvdMolen.
    Moderator bcworkz

    (@bcworkz)

    You’re welcome. Doesn’t hurt to ask, or do a little searching before embarking on a coding project ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Sync plugin settings (wp_options table) on multiple environments’ is closed to new replies.