1. 首页
  2. WordPress 函数手册

remove_theme_support()

remove_theme_support( string $feature )

允许主题取消注册对特定功能的支持
Allows a theme to de-register its support of a certain feature

目录锚点:#说明#参数#返回#源码#笔记


说明(Description)

应该在主题的函数.php文件。通常用于子主题以覆盖父主题的支持。


参数(Parameters)

参数 类型 必填 说明
$feature (string) 必需 正在删除的功能。

返回(Return)

(bool|void)是否删除了功能。


源码(Source)

/**
 * Allows a theme to de-register its support of a certain feature
 *
 * Should be called in the theme's functions.php file. Generally would
 * be used for child themes to override support from the parent theme.
 *
 * @since 3.0.0
 * @see add_theme_support()
 * @param string $feature the feature being added
 * @return bool|void Whether feature was removed.
 */
function remove_theme_support( $feature ) {
	// Blacklist: for internal registrations not used directly by themes.
	if ( in_array( $feature, array( 'editor-style', 'widgets', 'menus' ) ) )
		return false;

	return _remove_theme_support( $feature );
}
更新版本 源码位置 使用 被使用
3.0.0 wp-includes/theme.php:2739 2 1 function

笔记(Notes)

删除子主题中的功能

remove_theme_support() 为WP2原创文章,链接:https://www.wp2.cn/functions/remove_theme_support/

发表评论

您的电子邮箱地址不会被公开。