返回介绍

_remove_theme_support()

发布于 2017-09-11 13:35:49 字数 2723 浏览 811 评论 0 收藏 0

Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

_remove_theme_support( string $feature )

Do not use. Removes theme support internally, ignorant of the blacklist.


description


参数

$feature

(string) (Required)


源代码

File: wp-includes/theme.php

function _remove_theme_support( $feature ) {
	global $_wp_theme_features;

	switch ( $feature ) {
		case 'custom-header-uploads' :
			if ( ! isset( $_wp_theme_features['custom-header'] ) )
				return false;
			add_theme_support( 'custom-header', array( 'uploads' => false ) );
			return; // Do not continue - custom-header-uploads no longer exists.
	}

	if ( ! isset( $_wp_theme_features[ $feature ] ) )
		return false;

	switch ( $feature ) {
		case 'custom-header' :
			if ( ! did_action( 'wp_loaded' ) )
				break;
			$support = get_theme_support( 'custom-header' );
			if ( isset( $support[0]['wp-head-callback'] ) ) {
				remove_action( 'wp_head', $support[0]['wp-head-callback'] );
			}
			if ( isset( $GLOBALS['custom_image_header'] ) ) {
				remove_action( 'admin_menu', array( $GLOBALS['custom_image_header'], 'init' ) );
				unset( $GLOBALS['custom_image_header'] );
			}
			break;

		case 'custom-background' :
			if ( ! did_action( 'wp_loaded' ) )
				break;
			$support = get_theme_support( 'custom-background' );
			remove_action( 'wp_head', $support[0]['wp-head-callback'] );
			remove_action( 'admin_menu', array( $GLOBALS['custom_background'], 'init' ) );
			unset( $GLOBALS['custom_background'] );
			break;
	}

	unset( $_wp_theme_features[ $feature ] );
	return true;
}

更新日志

Versiondescription
3.1.0Introduced.

相关函数

Uses

  • wp-includes/theme.php: add_theme_support()
  • wp-includes/theme.php: get_theme_support()
  • wp-includes/plugin.php: remove_action()
  • wp-includes/plugin.php: did_action()

Used By

  • wp-includes/theme.php: remove_editor_styles()
  • wp-includes/theme.php: remove_theme_support()
  • wp-includes/nav-menu.php: unregister_nav_menu()

User Contributed Notes

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文