[wp-trac] [WordPress Trac] #24844: get_theme_mods doesn't return the theme customizer preview's new values.

WordPress Trac noreply at wordpress.org
Fri Jul 26 15:16:48 UTC 2013


#24844: get_theme_mods doesn't return the theme customizer preview's new values.
--------------------------+------------------------------
 Reporter:  nessworthy    |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Themes        |     Version:  3.5.2
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+------------------------------
Description changed by SergeyBiryukov:

Old description:

> Using the theme customizer API, you can call get_theme_mod($option) to
> return the value for a specific theme option.
>
> In the case of the user interacting with the theme customizer, if they
> have changed an option, the theme customizer replaces the saved option
> with the previewed / new setting by hooking onto the
> {{{theme_mod_$name}}} filter applied in {{{get_theme_mod}}}.
>
> However, should the user need or desire to retrieve all theme mods at
> once, the filter is not applied, and the new settings are never injected
> into the saved settings array.
>
> There's a workaround to simply loop through the settings and manually
> apply the filter, but it would be better if {{{get_theme_mods}}} had an
> argument like {{{$use_filter}}} and could add the filter in the core
> functionality.
>
> {{{get_theme_mods}}} is in {{{wp-includes/theme.php}}} on line 746.
> {{{get_theme_mod}}} is in {{{wp-includes/theme.php}}} on line 776.
> {{{theme_mod_$name}}} filter is applied in {{{wp-includes/theme.php}}} on
> lines 780 and 785.
> {{{ theme_mod_$name}}} filter is added in {{{wp-includes/class-wp-
> customize-setting.php}}} on line 72.

New description:

 Using the theme customizer API, you can call get_theme_mod($option) to
 return the value for a specific theme option.

 In the case of the user interacting with the theme customizer, if they
 have changed an option, the theme customizer replaces the saved option
 with the previewed / new setting by hooking onto the {{{theme_mod_$name}}}
 filter applied in {{{get_theme_mod}}}.

 However, should the user need or desire to retrieve all theme mods at
 once, the filter is not applied, and the new settings are never injected
 into the saved settings array.

 There's a workaround to simply loop through the settings and manually
 apply the filter, but it would be better if {{{get_theme_mods}}} had an
 argument like {{{$use_filter}}} and could add the filter in the core
 functionality.

 {{{get_theme_mods}}} is in [source:tags/3.5.2/wp-includes/theme.php#L746
 wp-includes/theme.php] on line 746.
 {{{get_theme_mod}}} is in [source:tags/3.5.2/wp-includes/theme.php#L776
 wp-includes/theme.php] on line 776.
 {{{theme_mod_$name}}} filter is applied in [source:tags/3.5.2/wp-
 includes/theme.php#L780 wp-includes/theme.php] on lines 780 and 785.
 {{{ theme_mod_$name}}} filter is added in [source:tags/3.5.2/wp-includes
 /class-wp-customize-setting.php#L72 wp-includes/class-wp-customize-
 setting.php] on line 72.

--

--
Ticket URL: <http://core.trac.wordpress.org/ticket/24844#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list