I thought there was a conditional for a custom image header that could check whether an image had been added (not whether the feature was enabled, but actually being used). I wanted to use it to add a body class, but I can't find it again. Does anyone know of how to check if the site has a custom header?

1 Answer 1


you could try the following right before you call the body_class() function:

$header_image = get_header_image();
if( !empty( $header_image) ){
    $custom_body_class = 'has-header-image';
} else {
    $custom_body_class = 'no-header-image';
<body <?php body_class($custom_body_class); ?>>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.