_remove_theme_support( string $feature ): bool
- Since
- 3.1.0
- Source
wp-includes/theme.php:3090
Do not use. Removes theme support internally without knowledge of those not used by themes directly.
Parameters
$featurestring- The feature being removed. See add_theme_support() for the list of possible values.
Return
bool- True if support was removed, false if the feature was not registered.
Uses · 4
- add_theme_support()Registers theme support for a given feature.
- did_action()Retrieves the number of times an action has been fired during the current request.
- get_theme_support()Gets the theme support arguments passed when registering that support.
- remove_action()Removes a callback function from an action hook.
Used by · 3
- remove_editor_styles()Removes all visual editor stylesheets.
- remove_theme_support()Allows a theme to de-register its support of a certain feature
- unregister_nav_menu()Unregisters a navigation menu location for a theme.
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 true; // 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;}History
Introduced in 3.1.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.0.4 tag, from
src/wp-includes/theme.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.