public static function set_theme_setting($setting_name, $value) { $return = false; if (ThemeSettings::has_setting($setting_name) != false) { $mods = self::_get_theme_mods_option(); $old_value = isset($mods[$setting_name]) ? $mods[$setting_name] : false; /** * Filter the theme mod value on save. * * The dynamic portion of the hook name, `$name`, refers to the key name of * the modification array. For example, 'header_textcolor', 'header_image', * and so on depending on the theme options. * * @since 3.9.0 * * @param string $value The new value of the theme mod. * @param string $old_value The current value of the theme mod. */ $mods[$setting_name] = apply_filters("pre_set_theme_mod_{$setting_name}", $value, $old_value); $theme = get_option('stylesheet'); $result = update_option("theme_mods_{$theme}", $mods); if (!empty($result) && $old_value != $value) { $return = true; } } return $return; }