Title: Theme Default settings not saving
Last modified: August 22, 2016

---

# Theme Default settings not saving

 *  [alvaro05](https://wordpress.org/support/users/alvaro05/)
 * (@alvaro05)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/theme-default-settings-not-saving/)
 * I want to set the Default values in my theme for the different fonts.
    After 
   investigating very much and thanks to the help Sunny provided I came up with:
 *     ```
       function aaa_egf_default_controls($options) {
   
       	// Here's how to remove some default controls
       	unset($options['tt_default_body']);
       	unset($options['tt_default_heading_1']);
       	unset($options['tt_default_heading_2']);
       	unset($options['tt_default_heading_3']);
       	unset($options['tt_default_heading_4']);
       	unset($options['tt_default_heading_5']);
       	unset($options['tt_default_heading_6']);
   
       	$options['post_text_full'] = array(
       		'name' => 'post_text_full',
       		'title' => __('Post content', 'easy-google-fonts'),
       		'description' => __("Edit Font", 'easy-google-fonts'),
       		'tab' => 'full',// I created a section for this
       		'properties' => array(
       			'selector' => 'body',
       		),
       		'default' => array(
       			'subset' => 'latin,all',
       			'font_id' => 'roboto',
       			'font_name' => 'Roboto',
       			'font_color' => '#333333',
       			'font_weight' => '300',
       			'font_style' => '',
       			// 'font_weight_style'   => '',
       			'background_color' => '',
       			'stylesheet_url' => 'https://fonts.googleapis.com/css?family=Roboto',
       			// 'text_decoration'     => '',
       			'text_transform' => 'none',
       			'line_height' => '1.4',
       			'font_size' => array(
       				'amount' => '15',
       				'unit' => 'px',
       			),
       		),
       	);	return $options;
       }
       add_filter('tt_font_get_option_parameters', 'aaa_egf_default_controls');
       ```
   
 * I realized although this set the theme default value, when returning values, 
   most of them were empty. So after searching within the files of the plugin I 
   found out
    validate_settings() function has a $whitelist array that removes the
   mentioned values.
 * How can I overpass this array from outside of the plugin so my Default values
   dont dissapear?
 * [https://wordpress.org/plugins/easy-google-fonts/](https://wordpress.org/plugins/easy-google-fonts/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Sunny Johal](https://wordpress.org/support/users/sunny_johal/)
 * (@sunny_johal)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/theme-default-settings-not-saving/#post-5471217)
 * Hi Alvaro,
    It’s not a good idea to try to bypass that function as it sanitises
   the values before saving them to the database for security.
 * Can you describe exactly what you are trying to do (every detail e.g. The selector,
   font, font weight etc) and I’ll give you a hand when I get a moment. Cheers
 * Sunny
 *  Thread Starter [alvaro05](https://wordpress.org/support/users/alvaro05/)
 * (@alvaro05)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/theme-default-settings-not-saving/#post-5471220)
 * Thanks Sunny, I would really appreciate some help here as Im becoming a little
   bit crazy with this.
 *     ```
       function aaa_egf_default_controls($options) {
   
       	unset($options['tt_default_body']);
       	unset($options['tt_default_heading_1']);
       	unset($options['tt_default_heading_2']);
       	unset($options['tt_default_heading_3']);
       	unset($options['tt_default_heading_4']);
       	unset($options['tt_default_heading_5']);
       	unset($options['tt_default_heading_6']);
   
       	$options['example'] = array(
       		'name' => 'example',
       		'title' => __('Post content', 'easy-google-fonts'),
       		'description' => __("Edit Font", 'easy-google-fonts'),
       		'properties' => array(
       			'selector' => 'body',
       		),
       		'default' => array(
       			'subset' => 'latin,all',
       			'font_id' => 'lobster',
       			'font_name' => 'Lobster',
       			'font_color' => '#333333',
       			'font_weight' => '300',
       			'font_style' => '',
       			'font_weight_style'   => '',
       			'background_color' => '',
       			'stylesheet_url' => 'https://fonts.googleapis.com/css?family=Lobster',
       			'text_decoration'     => '',
       			'text_transform' => 'none',
       			'line_height' => '1.4',
       			'font_size' => array(
       				'amount' => '15',
       				'unit' => 'px',
       			),
       		),
       	);	return $options;
       }
       add_filter('tt_font_get_option_parameters', 'aaa_egf_default_controls');
       ```
   
 * I want to add default settings to my theme so:
    1.When the user activates the
   theme and then the plugin, those default settings apply. 2.When the user goes
   to the theme customizer and selects Theme Default as font, those default values
   apply.
 * Right now, when I add the code mentioned above,
    1. This works perfect. 2.Maybe
   I am missunderstanding the scope of this snippet I added. I expected this default
   settings would apply (the same way as in 1.) when I selected “Theme Default” 
   setting as font. However when selecting it, nothing is happening, the fonts is
   not loading and the selector is not applying.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Theme Default settings not saving’ is closed to new replies.

 * ![](https://ps.w.org/easy-google-fonts/assets/icon-256x256.png?rev=2562365)
 * [Easy Google Fonts](https://wordpress.org/plugins/easy-google-fonts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/easy-google-fonts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/easy-google-fonts/)
 * [Active Topics](https://wordpress.org/support/plugin/easy-google-fonts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/easy-google-fonts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/easy-google-fonts/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [alvaro05](https://wordpress.org/support/users/alvaro05/)
 * Last activity: [11 years, 7 months ago](https://wordpress.org/support/topic/theme-default-settings-not-saving/#post-5471220)
 * Status: not resolved