How to add a default value to get_option if it’s used as a variable?
So I originally suggested normalizing the options array; i.e. merging saved values with the default values. And this does solve the “undefined index” notice: $my_options = wp_parse_args( get_option( ‘my_options’ ), [ ‘my_background_color_option’ => ‘#000’, // … other args. ] ); But to make sure that an option is not empty (e.g. not ”, false, null, … Read more