Skip to content
This repository was archived by the owner on Dec 16, 2022. It is now read-only.
This repository was archived by the owner on Dec 16, 2022. It is now read-only.

Changing featured image from post preview no longer syncs to post edit screen #359

Closed
@westonruter

Description

@westonruter

If I click “Preview changes” in:

image

I am then opened in the Customizer where I can then select a featured image to preview:

image

However, upon clicking to go Back out of the Customizer, the featured image is not set in the metabox:

image

This used to work, so it may be a regression introduced in 4.8 or due to a change in the plugin itself.

This is the code in question:

// Handle syncing settings from Customizer to edit post admin page.
wp.customize.bind( 'settings-from-customizer', function( settings ) {
var value, nonce, settingId = EditPostPreviewAdmin.getPostMetaSettingId( metaKey );
if ( 'undefined' === typeof settings[ settingId ] ) {
return;
}
value = settings[ settingId ];
nonce = $( '#set_post_thumbnail_nonce' ).val();
$( inputSelector ).val( value ).trigger( 'change' );
if ( value > 0 ) {
wp.media.featuredImage.set( value );
} else {
window.WPRemoveThumbnail( nonce );
}
} );

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions