remove_theme_mod()

最后更新于:2021-11-27 21:45:05

remove_theme_mod( string$name)

Removes theme modification name from current theme list.

参数

$name

(string) (Required) Theme modification name.

源文件

文件: gc-includes/theme.php

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