How to save settings and data when you upgrade WP themes?

There are Customizer setting of the basement, there is a text introduced by the user. How to keep this text when you update the theme?

To update the theme I use:
Theme Update Checker Library 1.2 w-shadow.com

The sample code configuration of the basement.
/**
* Footer
*/
dco_customize_register function($wp_customize) {
//FOOTER
 $wp_customize->add_section('footer', array(
 'title' => 'Footer',
 'priority' => 1,
));

 //footer text
 $setting_name = 'footer_text';
 $wp_customize->add_setting($setting_name, array(
 'default' => 'Redy',
 'sanitize_callback' => 'sanitize_textarea_field',
 'transport' => 'postMessage'
));

 $wp_customize->add_control($setting_name, array(
 'section' => 'footer',
 'type' => 'textarea',
 'label' => 'Footer text',
));

 $wp_customize->selective_refresh->add_partial($setting_name, array(
 'selector' => '.footer-desc',
 'render_callback' => function() use ($setting_name) {
 return nl2br(get_theme_mod($setting_name));
}
));

}
 add_action( 'customize_register', 'dco_customize_register' );

?>
June 27th 19 at 15:33
2 answers
June 27th 19 at 15:35
There are Customizer setting of the basement, there is a text introduced by the user. How to keep this text when you update the theme?

If atomizer, then nothing should go wrong. It is a record in the database.
But if you have changed files, then this approach is bad. To do the child theme or plugin.
June 27th 19 at 15:37
It seems that you are using a modified default theme.
A few options:
  1. To make all functions.php
  2. To create a child theme according to the rules described on the wordpress website.

I think people will still be offered.
Amendment. L1 to make a plugin. functions.php updated W - Webster_Hean commented on June 27th 19 at 15:40
And functions.php will not be overwritten when you update the Wordpress? - Amy_McKenzie commented on June 27th 19 at 15:43
This is the theme file, if this is your theme, then no. - tyreek_Heidenreich commented on June 27th 19 at 15:46

Find more questions by tags WordPress