WordPress开发者和主题制作者的搜索引擎



remove_theme_mod ›

Since2.1.0
已弃用n/a
remove_theme_mod ( $name )
参数:
  • (string) $name Theme modification name.
    Required: Yes
定义在:
文档:

Remove theme modification name from current theme list.

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



源码

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