Support » Themes and Templates » custom header default image (don't save customize)

  • Hi,

    i would like to use a custom header with a default header image.

    function custom_theme_features()
    	$args = array(
    		'default-image'		=> 'header.png',
    		'width'			=> '1100',
    		'height'		=> '150',
    		'flex-height'		=> false,
    		'flex-width'		=> false,
    		'header-text'		=> true,
    		'default-text-color'	=> '#ff0'
    	add_theme_support( 'custom-header', $args );
    add_action( 'after_setup_theme', 'custom_theme_features' );

    When i now go to Appearance -> Customize -> Header Image and click Hide Image the Image is hidden 🙂
    But i can’t restore the default image with a click on Suggested Image. The image is displayed correctly in the preview but when i save and go back the default picture is not there.

    Does anyone have an idea?


Viewing 7 replies - 1 through 7 (of 7 total)
  • I just posted more or less the same question here. (Sorry folks, I missed seeing frypress’s question first.)

    Try this for ‘default-image’:
    'default-image' => get_template_directory_uri() . '/images/header.jpg'

    Make sure your header is inside the /image/ directory within your theme before editing.

    Well, I thought that would work (it did once upon a time for me). I tried this, and it doesn’t work for me, either. I set my default in this way:

    'default-image' => '/wp-admin/images/w-logo-blue.png?ver=20131202',

    …so I know the image exists, and it’s not defaulting back to it when I remove custom header images.

    Had the same problem – found the solution in twentythirteen/inc/custom-header.php

    You have to register the default image too!

    register_default_headers( array(
        'mypic' => array(
        'url'   => get_template_directory_uri() . '/images/header.png',
        'thumbnail_url' => get_template_directory_uri() . '/images/header-thumb.png',
        'description'   => _x( 'MyPic', 'header image description', 'yourtheme' )),

    Hope that helps!

    @uitznet you’re my hero. register_default_headers() works! that needs to be included on the custom-header documentation for sure.

    Thanks uitznet, you totally rock!




    Having the same issue too, but I cannot imagine I must also use the register_default_headers, because it´s not mentioned in the WP codex.


Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘custom header default image (don't save customize)’ is closed to new replies.