Save option as single value instead of an array?

Support MB Settings Page Save option as single value instead of an array?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #21171
    Content PilotContent Pilot
    Participant

    I am building a small settings page and want to have direct access to each option versus grabbing all options as an array and pulling out a single option from that array.

    I read the docs and it says the only method right now is to save as an array.

    https://docs.metabox.io/extensions/mb-settings-page/#data

    Is it possible to save the value of the setting to the database as a single value?

    Is there a plan to add this functionality?

    I think this is very similar to how you offer the option to save post meta as an array or single value with 'multiple' => true

    https://docs.metabox.io/database/#cloneable-fields

    #21178
    Long NguyenLong Nguyen
    Moderator

    Hi,

    We also create a notice in the data document section
    It’s the recommended way by WordPress that doesn’t make your options table bloat.
    The extension only supports to save all settings in an array (like the theme options theme_mods_theme-slug) to avoid bloating database.

    But it's an exciting idea, and I will create a feature request for the developer team to research and support this case.

    #21200
    Content PilotContent Pilot
    Participant

    I would really appreciate if we could have the option to save as array or string. When we release new versions of our plugin, sometimes we run database updates which are MUCH easier when values live inside single cells, not arrays. I understand WordPress is trying to set a standard to not overload the database. But if you know what you are doing, then there should be an option to have it another way.

    Thanks for adding it to the roadmap.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.