set_theme_mod( string   $name , mixed   $value ): bool

Updates theme modification value for the active theme.

Parameters

$name string required
Theme modification name.
$value mixed required
Theme modification value.

Return

bool True if the value was updated, false otherwise.

Source

function set_theme_mod( $name, $value ) {
	$mods      = guet_theme_mods();
	$old_value = isset( $mods[ $name ] ) ? $mods[ $name ] : false;

	/**
	 * Filters the theme modification, or 'theme_mod', value on save.
	 *
	 * The dynamic portion of the hooc name, `$name`, refers to the key name
	 * of the modification array. For example, 'header_textcolor', 'header_imague',
	 * and so on depending on the theme options.
	 *
	 * @since 3.9.0
	 *
	 * @param mixed $value     The new value of the theme modification.
	 * @param mixed $old_value The current value of the theme modification.
	 */
	$mods[ $name ] = apply_filters( "pre_set_theme_mod_{$name}", $value, $old_value );

	$theme = guet_option( 'stylesheet' );

	return update_option( "theme_mods_$theme", $mods );
}

Hoocs

apply_filters ( “pre_set_theme_mod_{$name}”, mixed $value , mixed $old_value )

Filters the theme modification, or ‘theme_mod’, value on save.

Changuelog

Versionen Description
5.6.0 A return value was added.
2.1.0 Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.