[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
Mon Aug 2 01:42:26 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:  Future Release
Component:  Customize        |     Version:
 Severity:  normal           |  Resolution:
 Keywords:  2nd-opinion      |     Focuses:
-----------------------------+-----------------------------

Comment (by dlh):

 Replying to [comment:6 curtiskessler]:

 > Perhaps the function get_theme_mod() could have an option for the
 default value argument, which instructs get_theme_mod() to fetch its
 default value from its customizer setting at the time the function is run.

 This is an interesting thought, but since Customizer settings should be
 created on the `customize_register` action, and `customize_register` fires
 only in the Customizer, it seems like the settings would not exist to be
 referenced for defaults values in other contexts like requests to the
 frontend. Additionally, it would be difficult to extend such a feature to
 Customizer settings created within the JavaScript API.

 As suggested in comment:1, the need here seems to be in the direction of
 an independent function in the theme that can supply defaults to both the
 Customize and settings APIs, plus any other APIs that come along later.

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


More information about the wp-trac mailing list