get_theme_mods doesn't return the theme customizer preview's new values.
|Reported by:||nessworthy||Owned by:|
Description (last modified by SergeyBiryukov)
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.