_remove_theme_support

The timeline below displays how wordpress function _remove_theme_support has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.5

/**
 * Do not use. Removes theme support internally without knowledge of those not used
 * by themes directly.
 *
 * @access private
 * @since 3.1.0
 * @global array               $_wp_theme_features
 * @global Custom_Image_Header $custom_image_header
 * @global Custom_Background   $custom_background
 *
 * @param string $feature 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.
 */
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;
    }
    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;
}

WordPress Version: 5.2

/**
 * Do not use. Removes theme support internally, ignorant of the blacklist.
 *
 * @access private
 * @since 3.1.0
 *
 * @global array               $_wp_theme_features
 * @global Custom_Image_Header $custom_image_header
 * @global Custom_Background   $custom_background
 *
 * @param string $feature
 */
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;
    }
    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;
}

WordPress Version: 4.7

/**
 * Do not use. Removes theme support internally, ignorant of the blacklist.
 *
 * @access private
 * @since 3.1.0
 *
 * @global array               $_wp_theme_features
 * @global Custom_Image_Header $custom_image_header
 * @global Custom_Background   $custom_background
 *
 * @param string $feature
 */
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;
    }
    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;
}

WordPress Version: 4.3

/**
 * Do not use. Removes theme support internally, ignorant of the blacklist.
 *
 * @access private
 * @since 3.1.0
 *
 * @global array               $_wp_theme_features
 * @global Custom_Image_Header $custom_image_header
 * @global Custom_Background   $custom_background
 *
 * @param string $feature
 */
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;
    }
    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 ($support[0]['wp-head-callback']) {
                remove_action('wp_head', $support[0]['wp-head-callback']);
            }
            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;
}

WordPress Version: 4.1

/**
 * Do not use. Removes theme support internally, ignorant of the blacklist.
 *
 * @access private
 * @since 3.1.0
 * @param string $feature
 */
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;
    }
    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 ($support[0]['wp-head-callback']) {
                remove_action('wp_head', $support[0]['wp-head-callback']);
            }
            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;
}

WordPress Version: 3.7

/**
 * Do not use. Removes theme support internally, ignorant of the blacklist.
 *
 * @access private
 * @since 3.1.0
 */
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;
    }
    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 ($support[0]['wp-head-callback']) {
                remove_action('wp_head', $support[0]['wp-head-callback']);
            }
            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;
}