Support » Fixing WordPress » Save or Fetch Settings as a Group (But not for an options page)

  • Leo Blanchette


    I’m not sure I understand this properly, or maybe I’m just not searching it properly.

    How do you save options such as they are part of a family that can be fetched in one query?

    Is it necessary to do this through an options page, or can it also be done programatically?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Well… it depends on how you want to code your options and how you want to retrieve them.

    WP provides a way to ‘register’ settings so they are easily accessed using a simple line of code such as get_option(). You can either store them separately (not desirable), or as an array (preferred).

    However, if you need more control over your options.. and want to setup your own database tables.. you can use the global $wpdb to prepare and execute your database args and queries.

    Hope this helps…

    Leo Blanchette


    Ok, I’ve been using update_option() and get_option() for quite some time.

    So really the most practical way would be to pack a bunch of settings into one array and then do an update_option('buncha_stuff', $array); ?

    Yup. That’s the “cleanest” and most preferred, in my opinion.

    You have to be careful to only update the ones you need.. and not erase the others in the process. You can use a conditional to check if each option has changed before updating.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Save or Fetch Settings as a Group (But not for an options page)’ is closed to new replies.