WordPress at Your Fingertips

remove_theme_mod() WP 1.0

Remove theme modification name from current theme list.

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

1 time — 0.001562 sec (very slow) | 50000 times — 2.79 sec (fast)

No Hooks.

Return

null. Nothing.

Usage

remove_theme_mod( $name );
$name(string) (required)
Theme modification name.

Changelog

Since 2.1.0 Introduced.

Code of remove_theme_mod() WP 5.8.1

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 );
}

Theme Modification API (theme mods options settings)

Other Theme Functions

No comments
    Log In