[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
Wed Jul 28 01:54:50 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):

 Every option should have a default value (not just some).
 I told you how to do it: define a function that applies a filter for child
 themes, and all it does is supply the defaults. (In my theme, I broke it
 into several functions to supply values that are needed together.) The
 theme likely won't be using any one option multiple times, though.

 It is **not** a good idea to write defaults to the database, because the
 theme should not affect its environment like that. The theme doesn't know
 (although it can check) if it's in preview mode or being used temporarily
 as a test to isolate a problem or being shown in the .org Theme Previewer
 or being used on a per-page basis by a theme switcher plugin.
 Themes are for output, and should only save when the user is choosing
 that.

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


More information about the wp-trac mailing list