remove_theme_mod()删除主题自定义修改值

目录

描述

Remove theme modification name from current theme list.

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

remove_theme_mod() 描述

用法

<?php remove_theme_mod$name ?>

remove_theme_mod() 用法

参数

$name

(string) (必填) Theme modification name.

默认值: None

remove_theme_mod() 参数

返回值

(null) 

remove_theme_mod() 返回值

历史

添加于 版本: 2.1.0

remove_theme_mod() 历史

源文件

remove_theme_mod() 函数的代码位于 wp-includes/theme.php.

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */
/**
 * Remove theme modification name from current theme list.
 *
 * If removing the name also removes all elements, then the entire option will
 * be removed.
 *
 * @since 2.1.0
 *
 * @param string $name Theme modification name.
 */
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 );
}

remove_theme_mod() 源文件

相关