To activate the Customizer core section Navigation (ID: nav), you need to:

add_theme_support( 'custom-header' );

I already tried to make the transport of the Customizer header_image setting postMessage with the ID based on what I’m seeing at get_header_image():

function theme_customize_register( $wp_customize ) {
    $wp_customize->get_setting( 'header_image' )->transport="postMessage";

    // I also tried this line.
    // $wp_customize->get_setting( 'header_image', get_theme_support( 'custom-header', 'default-image' ) )->transport="postMessage";
}
add_action( 'customize_register', 'theme_customize_register' );

But the setting transport is still refresh. And because the code above didn’t work, it looks like the ID of the Customizer Header Image setting is not header_image.. What is the Header Image’s ID and how to make it postMessage?

1 Answer
1

Luckily, I was facing the same issue an hour ago so I brainstormed for a long time to find a find a solution. I posted it here before seeing this: http://www.hardeepasrani.com/2015/12/using-postmessage-transport-method-for-header-image/

So instead of just using:

$wp_customize->get_setting( 'header_image' )->transport="postMessage";

I used:

$wp_customize->get_setting( 'header_image'  )->transport="postMessage";
$wp_customize->get_setting( 'header_image_data'  )->transport="postMessage";

After that, in JS, we got the value using header_image.

Hope it helps you. 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *