remove_theme_mod() - WordPress 函数参考中文文档

返回介绍

remove_theme_mod()

发布于 2017-09-11 字数1962 浏览 818 评论 0

remove_theme_mod( string $name )

Remove theme modification name from current theme list.


描述

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


参数

$name

(string)
(Required)
Theme modification name.


源代码

File: wp-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 );
}

更新日志

Version 描述
2.1.0 Introduced.

相关函数

Uses

  • wp-includes/theme.php:
    remove_theme_mods()
  • wp-includes/theme.php:
    get_theme_mods()
  • wp-includes/option.php:
    update_option()
  • wp-includes/option.php:
    get_option()

Used By

  • wp-admin/custom-header.php:
    Custom_Image_Header::set_header_image()
  • wp-admin/custom-background.php:
    Custom_Background::take_action()
  • wp-includes/theme.php:
    _delete_attachment_theme_mod()
  • wp-includes/theme.php:
    switch_theme()
  • wp-includes/customize/class-wp-customize-background-image-setting.php:
    WP_Customize_Background_Image_Setting::update()
  • wp-includes/widgets.php:
    retrieve_widgets()
  • Show 1 more used by
    Hide more used by


User Contributed Notes

上一篇:remove_submenu_page()

下一篇:remove_theme_mods()

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!