Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #53807, comment 7


Ignore:
Timestamp:
08/02/2021 01:42:47 AM (3 years ago)
Author:
dlh
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #53807, comment 7

    initial v1  
    33> 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.
    44
    5 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.
     5This 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 default 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.
    66
    77As 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.