The remove_custom_image_header() WordPress PHP function removes the custom image header support from a theme.
Usage
To use the remove_custom_image_header() function, simply add it to your functions.php file:
remove_custom_image_header();
Parameters
This function has no parameters.
More information
See WordPress Developer Resources: remove_custom_image_header()
Examples
Removing Custom Image Header Support
Remove custom image header support from a theme.
// Remove custom image header support
add_action('after_setup_theme', 'my_theme_remove_custom_image_header');
function my_theme_remove_custom_image_header() {
remove_custom_image_header();
}
Conditionally Removing Custom Image Header Support
Remove custom image header support only if a certain condition is met.
// Conditionally remove custom image header support
add_action('after_setup_theme', 'my_theme_conditional_remove_custom_image_header');
function my_theme_conditional_remove_custom_image_header() {
if (/* your condition here */) {
remove_custom_image_header();
}
}
Remove Custom Image Header Support and Other Theme Supports
Remove custom image header support along with other theme support features.
// Remove multiple theme support features
add_action('after_setup_theme', 'my_theme_remove_multiple_supports');
function my_theme_remove_multiple_supports() {
remove_custom_image_header();
remove_theme_support('custom-background');
remove_theme_support('custom-logo');
}
Re-adding Custom Image Header Support After Removal
Remove custom image header support and re-add it later.
// Remove and re-add custom image header support
add_action('after_setup_theme', 'my_theme_change_custom_image_header');
function my_theme_change_custom_image_header() {
remove_custom_image_header();
// Re-add custom image header support with new parameters
add_theme_support('custom-header', array(
'width' => 1200,
'height' => 600,
));
}
Removing Custom Image Header Support from a Child Theme
Remove custom image header support from a child theme.
// Remove custom image header support in child theme
add_action('after_setup_theme', 'my_child_theme_remove_custom_image_header', 11);
function my_child_theme_remove_custom_image_header() {
remove_custom_image_header();
}