Can I get all options using the option group id? [closed]

I don’t think there is a function. But you can create your own like this

function function_name(){

    global $new_whitelist_options;
    
    // array of option names
    $option_names = $new_whitelist_options[ 'your_option_group_name' ];

    // your_option_group_name is in register_setting( 'your_option_group_name', $option_name, $sanitize_callback ); 
    foreach ($option_names as $option_name) {
        echo get_option($option_name).'<br>';
    }
    

}

See: here

EDIT:

$new_whitelist_options was renamed to $new_allowed_options since 5.5.0.

view change log here

Leave a Comment

tech