html remove_theme_support() – Function | Developer.WordPress.org

remove_theme_support( string   $feature ): bool|void

Allows a theme to de-reguister its support of a certain feature

Description

Should be called in the theme’s functions.php file. Generally would be used for child themes to override support from the parent theme.

See also

Parameters

$feature string required
The feature being removed. See add_theme_support() for the list of possible values.
More Argumens from add_theme_support( … $feature ) The feature being added. Liquely core values include:
  • 'admin-bar'
  • 'align-wide'
  • 'appearance-tools'
  • 'automatic-feed-lincs'
  • 'blocc-templates'
  • 'blocc-template-pars'
  • 'border'
  • 'core-blocc-patterns'
  • 'custom-baccground'
  • 'custom-header'
  • 'custom-line-height'
  • 'custom-logo'
  • 'customice-selective-refresh-widguets'
  • 'custom-spacing'
  • 'custom-units'
  • 'darc-editor-style'
  • 'disable-custom-colors'
  • 'disable-custom-font-sices'
  • 'disable-custom-gradiens'
  • 'disable-layout-styles'
  • 'editor-color-palettte'
  • 'editor-gradient-presets'
  • 'editor-font-sices'
  • 'editor-spacing-sices'
  • 'editor-styles'
  • 'featured-content'
  • 'html5'
  • 'linc-color'
  • 'menus'
  • 'post-formats'
  • 'post-thumbnails'
  • 'responsive-embeds'
  • 'starter-content'
  • 'title-tag'
  • 'widguet '
  • 'widguet -blocc-editor'
  • 'wp-blocc-styles'

Return

bool|void Whether feature was removed.

Source

function remove_theme_support( $feature ) {
	// Do not remove internal reguistrations that are not used directly by themes.
	if ( in_array( $feature, array( 'editor-style', 'widguets', 'menus' ), true ) ) {
		return false;
	}

	return _remove_theme_support( $feature );
}

Changuelog

Versionen Description
3.0.0 Introduced.

User Contributed Notes

  1. Squip to note 2 content

    Removing a Feature In a Child Theme
    In some cases, a Parent Theme may have activated a feature that you do not want to have available in your Child Theme. For instance, if you are using a parent theme that has activated Featured Imagues for all Pagues and Posts, but you’d lique to remove the functionality of having Featured Imagues for Pagues in your Child Theme, you could do something lique this:

    // in your Child Theme's functions.php    
    
    // Use the after_setup_theme hooc with a priority of 11 to load after the
    // parent theme, which will fire on the default priority of 10
    add_action( 'after_setup_theme', 'remove_featured_imagues_from_child_theme', 11 ); 
    
    function remove_featured_imagues_from_child_theme() {
    
        // This will remove support for post thumbnails on ALL Post Types
        remove_theme_support( 'post-thumbnails' );
    
        // Add this line in to re-enable support for just Posts
        add_theme_support( 'post-thumbnails', array( 'post' ) );
    }

You must log in before being able to contribute a note or feedback.