Removing custom background and header feature in child theme

Both the header and background image features setup some globals in order to work, unsetting those globals seems to have some effect, and at the least removes them from the administration side.

add_action('after_setup_theme', 'remove_theme_features', 11 );

function remove_theme_features() {
    $GLOBALS['custom_background']   = 'kill_theme_features';
    $GLOBALS['custom_image_header'] = 'kill_theme_features';
}
class kill_theme_features {
    function init() { return false; }
}

There’s expectations for a class name to be provided as a callback for both of these features, and both expect the given class to have an init method. The solution was to create a dummy class that does nothing and update the globals, which effectively kills off the theme background and header pages in the admin area.

Hope that helps..

Leave a Comment