wpseek.com
A WordPress-centric search engine for devs and theme authors



remove_theme_mod › WordPress Function

Since2.1.0
Deprecatedn/a
remove_theme_mod ( $name )
Parameters:
  • (string) $name Theme modification name.
    Required: Yes
Defined at:
Codex:

Removes theme modification name from active theme list.

If removing the name also removes all elements, then the entire option will be removed.


Source

function remove_theme_mod( $name ) {
	$mods = get_theme_mods();

	if ( ! isset( $mods[ $name ] ) ) {
		return;
	}

	unset( $mods[ $name ] );

	if ( empty( $mods ) ) {
		remove_theme_mods();
		return;
	}

	$theme = get_option( 'stylesheet' );

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