Here is my code in functions.php

    'default-image'          => '',
    'width'                  => 500,
    'height'                 => 500,
    'flex-height'            => true,
    'flex-width'             => true,
    'uploads'                => true,
    'random-default'         => false,
    'header-text'            => true,
    'default-text-color'     => '',
    'wp-head-callback'       => '',
    'admin-head-callback'    => '',
    'admin-preview-callback' => '',
add_theme_support( 'custom-header' ,$custom_header_args);

And here is my code in header.php

<img src="<?php header_image(); ?>" height="<?php get_custom_header()->height ?>" width="<?php get_custom_header()->width; ?>" alt="">
<?php wp_nav_menu( array('theme_location'  => 'primary') ); ?>

My question is it does not change the height and width of my header image. What is the problem?

1 Answer 1


You have forgot to do "echo" the Height & Width in Image code. Your Header code should like below.

<img src="<?php header_image(); ?>" height="<?php echo get_custom_header()->height; ?>" width="<?php echo get_custom_header()->width; ?>" alt="">
<?php wp_nav_menu( array('theme_location'  => 'primary') ); ?>

check this reference https://codex.wordpress.org/Custom_Headers

  • even though I put an echo it does not change the height and width when it display in the website...I use vardump to check the size and here is the result ... ["width"]=> int(402) ["height"]=> int(125) ["video"]=> bool(false) ["attachment_id"]=> int(79) } it remains the size from where I upload the image.. Commented Sep 13, 2019 at 6:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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