pre_set_theme_mod_(name) filter-hookWP 3.9.0

Filters the theme modification, or '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.

Usage

add_filter( 'pre_set_theme_mod_(name)', 'wp_kama_pre_set_theme_mod_name_filter', 10, 2 );

/**
 * Function for `pre_set_theme_mod_(name)` filter-hook.
 * 
 * @param mixed $value     The new value of the theme modification.
 * @param mixed $old_value The current value of the theme modification.
 *
 * @return mixed
 */
function wp_kama_pre_set_theme_mod_name_filter( $value, $old_value ){

	// filter...
	return $value;
}
$value(mixed)
The new value of the theme modification.
$old_value(mixed)
The current value of the theme modification.

Changelog

Since 3.9.0 Introduced.

Where the hook is called

set_theme_mod()
pre_set_theme_mod_(name)
wp-includes/theme.php 1088
$mods[ $name ] = apply_filters( "pre_set_theme_mod_{$name}", $value, $old_value );

Where the hook is used in WordPress

wp-includes/blocks/site-logo.php 141
add_filter( 'pre_set_theme_mod_custom_logo', '_sync_custom_logo_to_site_logo' );