How to get all option name in option group?

3 Replies ·

  1. Hi Justin and all,

    When we register our option using register_settings()

    We define the option group,

    Is there a way to get the list of option name in the same group?

    Thank you.

  2. Justin Tadlock

    I don’t believe there’s a function, but you can use the `$new_whitelist_options` global:

    global $new_whitelist_options;

    // array of option names
    $option_names = $new_whitelist_options[ $option_group ];

  3. Justin Tadlock

    Cool. I wish WP would flesh out the APIs for some of this stuff sometimes. I hate relying on globals like that, but it’s all we’ve got to work with.