-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable previewing changes to the post featured image #12037
Conversation
Note: I reviewed the current core/classic editor behavior for previewing drafts and confirmed that for drafts core performs a full (draft) save for previews. whatever you set as featured image gets saved when you click preview on drafts. We should probably replicate that behavior in Gutenberg. We can probably switch to performing a full save right in @aduth or @youknowriad appreciate any feedback on the best approach, I will open an issue to track this task separately. |
let previewLink = getAutosaveAttribute( 'preview_link' ); | ||
const featuredImageId = getEditedPostAttribute( 'featured_media' ); | ||
if ( previewLink && featuredImageId ) { | ||
previewLink = addQueryArgs( previewLink, { _thumbnail_id: featuredImageId } ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is how Core does it, I'm totally fine with the approach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not certain though how #11409 would fix for non published posts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm that you can't see the featured image until your draft is saved.
Match the Classic Editor's behaviour by appending _thumbnail_id to the post preview URL so that changes to the featured image are visible.
0fcff22
to
5901512
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It solves the issue for drafts and published posts that are saved.
Let's ship it as is and tackle the last case separately ad @adamsilverstein suggested.
Fixes partially #9151
Match the Classic Editor's behaviour by appending _thumbnail_id to the
post preview URL so that changes to the featured image are visible.
Description
Pass the featured image id to the preview screen. Currently only works with published posts (possibly resolved by #11409)
How has this been tested?
Screenshots
Types of changes
Checklist: