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. 🙂
Related Posts:
- Compare the old get_theme_mod($name) to the new get_theme_mod($name) return value
- Function to return true if current page has child pages
- List of all theme customizer control types?
- How to get the registered sidebar’s name by its id?
- One button to change all settings in theme customizer?
- The best way to customize “nav-menu-template.php” to add if the ‘link_before’ is “checkbox”
- Design view breaking on Pages
- Widgets not showing in my custom theme
- Can’t load WP function into external function
- Set WordPress Default Template
- Customizer: Output default value in Customizer CSS
- Create another “Display Site Title and Tagline” checkbox, “Header Text Color” setting and control
- Converting HTML Template to WordPress Theme
- Customizer: active_callback and sanitize_callback incompatibility?
- How do I link a button I created in theme customizer to a function?
- Is the “_s” on this `sprintf(__(‘Page %s’, ‘_s’), max($paged, $page))` just refer to a text domain?
- How to obtain the current website URL in my theme?
- What exactly do this function declared into functions.php file of a WP theme?
- get_template_directory adding FTP root folders in urls
- Is there a hack for using is_page() within the function.php file?
- How can I assign separate stylesheets to different pages?
- How to make sure relative URL works when site is not on root domain?
- Dynamically switch file in get_template_directory_uri() | Function [closed]
- Uncaught TypeError: extract(): Argument #1 ($array) must be of type array, null given
- Menu to the right of screen on desktop using Bootstrap 4
- Where can I find the declaration of `$_wp_theme_features`?
- A Customizer checkbox control that sets the setting to “” or to “blank” and show() or hide() a color control
- My customizer’s setting doesn’t set to the default and needed to click the control’s “Default” button before it’ll be set
- WordPress causing all code to be displayed on line 1. Receiving multiple errors after cleaning cookies and cache
- How to add button to top of theme customizer?
- Need help setting default setting value for radio button in theme customizer
- Get author full name
- How to export/import theme customizer settings?
- Is it possible to get a theme customizer setting from wp.customize using jquery?
- How can I loop into two different DIVS without repeating the DIVs
- Removing unnecessary wordpress files
- How to add default images into theme customizer image control?
- Passing array in add_option()
- How do I list the_tags() into HTML data-attribute
- How to make thumbnail image fit into a div where image dimentions are completely different?
- Why WordPress architecture is not pure object oriented and it don’t use MVC pattern? [closed]
- Custom Logo URL | Help me print the URL of the custom logo I inserted into my theme
- How do themes render caption texts in extended markup (e.g. “wp-caption” paragraphs)
- PHP can I add line numbers to file_get_contents()
- Displaying theme options in css
- Setting custom canonical urls
- Trigger popup in a php if/else statement
- Where in PHP do I move title and meta (date) to bottom of each blog section?
- How do I add custom bulk actions to multiple custom post types?
- what is the best practice to add new field to an api route
- Catchable fatal error: Object of class stdClass could not be converted to string after WP 4.7
- Menu jumping when calling it via PHP
- Modify custom field input data before creating a new post
- Trying to retrieve post meta
- Need help enqueueing webfonts
- Is there a way to conditionally check whether a WordPress post title is empty?
- Redirect to another page using contact form 7? [closed]
- Use .php file as page instead of wordpress page & template file?
- Use WordPress function in php file
- Underscore – Self hosted fonts
- WordPress Customizer Default Image
- Why in my theme I can’t see all the statics content under the posts?
- Theme not calling Jquery properly
- Function Reference Documenting Template Tags for use in Custom Theme Templates?
- How to add the sidebar to all the pages except the home page? [closed]
- Header not properly displaying on archive.php
- Create page template via functions.php?
- How to create a field in customize and show that in header.php?
- How to make function appear in sentence?
- How Do I Find & Remove H1 From Site-Title-Wrapper? [closed]
- blank white page when post/update/change option etc
- Removing “Powered by” footer using child theme PHP [closed]
- How to add aria role and schema markup to custom walker container
- Randomize Color Scheme Selection in Theme
- How to correctly load a different version of main menu based on the user language in WordPress? Is it a good solution?
- Why in this WordPress theme I can’t see the Main Menu?
- pass html code to worpdress
- Can’t change theme name
- Customize field names in backend profile edit page through function.php [duplicate]
- Commas in Tag Cloud
- WordPress redirects page query parameter in URL
- Getting text from custom field from customizer
- Need help for some PHP code
- How to change basename url for wp-admin?
- how to replace h1 entry title with h2 in category pages only
- Not able to remove caption shortcode from the content
- File from parent theme imported to child theme doesn’t work – any ideas?
- Problem with displaying CSS Stylesheets – Am I adding them correctly in my wordpress child theme?
- require get_template_directory() . ‘path/to-my/file.php’ BREAKS customize > themes functionality
- Unable to retrieve get_author_posts_url
- Display post date also if the date it’s the same for each post
- Remove node from multisites?
- How to get php file based on URL in WordPress
- How can I customize a WordPress theme before it’s downloaded?
- Create a custom theme-specific page, invisible in the admin-panel?
- Extend the WP_Customize_Image_Control class to change its non-frame $button_labels
- Image not displayed
- Adding code to the function file
- Need help with Deprecated: Non-static error when update PHP 7.4 -> 8.1 with Dyad 2 theme
- a problem in class in class-wp-hook.php