wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes



remove_theme_mod › WordPress Function

Depuis2.1.0
Dépréciéen/a
remove_theme_mod ( $name )
Paramètres:
  • (string) $name Theme modification name.
    Requis: Oui
Défini(e) dans:
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 );
}