I’ve been following this great tutorial (http://wp.tutsplus.com/tutorials/theme-development/digging-into-the-theme-customizer-overview/) and now I have set the Theme customizer.
As far as I understand the settings I assign in the customizer are saved in the database every time the user “saves” in the theme customizer page. Which means that after activating the theme for the first time and before going to the customizer, the settings are not saved.
My question is, How can I save the settings just after the user activates the theme? (the $wp_customize->add_setting default value)
Pd. I’ve been looking for some time, and got this hooks: “after_setup_theme”, “switch_theme”, but I cant figure out how to do it.
Edit: The “duplicate question” answers how to provide a fallback when there is no setting available. Although it might be a workaround, I would like to know how to save (register) the settings when activating the theme.
You need only use the default value on the wp_customize and that is all
replace defaultvalue for the value you want, and when the user activate the theme this line will register the default value on the DB only when not exist on the DB