Do not use. Removes theme support internally without knowledge of those not used by themes directly.
Parameters
$feature
stringrequired- The feature being removed. See add_theme_support() for the list of possible values.
More Arguments from add_theme_support( … $feature )
The feature being added. Likely core values include:
'admin-bar'
'align-wide'
'appearance-tools'
'automatic-feed-links'
'block-templates'
'block-template-parts'
'border'
'core-block-patterns'
'custom-background'
'custom-header'
'custom-line-height'
'custom-logo'
'customize-selective-refresh-widgets'
'custom-spacing'
'custom-units'
'dark-editor-style'
'disable-custom-colors'
'disable-custom-font-sizes'
'disable-custom-gradients'
'disable-layout-styles'
'editor-color-palette'
'editor-gradient-presets'
'editor-font-sizes'
'editor-spacing-sizes'
'editor-styles'
'featured-content'
'html5'
'link-color'
'menus'
'post-formats'
'post-thumbnails'
'responsive-embeds'
'starter-content'
'title-tag'
'widgets'
'widgets-block-editor'
'wp-block-styles'
Source
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' );
if ( isset( $support[0]['wp-head-callback'] ) ) {
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;
}
Changelog
Version | Description |
---|---|
3.1.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.