Instead of using a hook to store the defaults, you can write the logic straight into get_theme_options
– if the value is false
, there are no options saved yet:
public static function get_theme_options() {
$options = get_option( 'theme_options' );
if ( $options === false ) {
$options = [
'key' => 'default_value',
];
add_option( 'theme_options', $options );
}
return $options;
}