[wp-trac] [WordPress Trac] #53807: Add function or filter to send all customizer setting default values to the database upon theme installation

WordPress Trac noreply at wordpress.org
Tue Jul 27 23:53:19 UTC 2021


#53807: Add function or filter to send all customizer setting default values to the
database upon theme installation
-----------------------------+------------------------------
 Reporter:  curtiskessler    |       Owner:  (none)
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Customize        |     Version:
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:
-----------------------------+------------------------------

Comment (by joyously):

 > To insert the customizer default values into the database so that they
 display on the front end upon theme installation, I believe (?) each theme
 mod must be manually entered into the database

 The theme should use the default value so it is displayed, regardless of
 what the database contains. The second parameter of the function call
 ''is'' the default value, already.

 > This requires duplication of every default value twice within the theme
 code

 No, it doesn't.

 > function or filter that theme developers can activate within
 functions.php to send all default customizer values to the database

 No, activating the theme should not have side effects in the database. The
 options should only be saved when the user chooses to save.

 The easiest way is for the theme to have a function that is filtered (for
 child themes) to supply the default values. This function would be called
 when the defaults are needed, which is when Customizer options are set up
 and when using each option.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53807#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list