A WordPress-centric search engine for devs and theme authors



remove_theme_mod ›

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

Remove theme modification name from current 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 );
}