Restrict featured image selection to single image#77213
Restrict featured image selection to single image#77213adamsilverstein wants to merge 1 commit intotrunkfrom
Conversation
The MediaUpload component for the featured image panel did not
explicitly set multiple={false}, allowing users to select multiple
images in the media library modal. Since a post can only have one
featured image, enforce single selection.
Props WordPress/wordpress-develop#8294.
See https://core.trac.wordpress.org/ticket/65053.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Size Change: +2 B (0%) Total Size: 7.74 MB 📦 View Changed
ℹ️ View Unchanged
|
|
Flaky tests detected in f603d85. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/24220299664
|
|
I tested this manually and verified it fixes the issue reported in https://core.trac.wordpress.org/ticket/65053 |
|
Unfortunately, the issue has not been resolved in my environment. Furthermore, it appears this problem is occurring elsewhere, such as with image blocks 🤔 e8a5098fe39fee4e64b81b409e3808d7.mp4 |
|
@t-hamano did you drag and drop those images onto the upload modal? I wonder if we get the same issue uploading to a gallery where multiples are allowed? |
I was unable to reproduce with the image block, any special steps @t-hamano ? please add more details or steps to reproduce. |
Yes. As you were able to reproduce the issue here, you may need to clear your media library once.
The |
Hmm, I thought I had cleared the media library, but maybe not completely. I wonder if this has something to do with starting with an empty library somehow braking the math used to calculate the counts for display. I'll keep digging, this probably needs some fix in core. |
|
Closing in favor of the upstream fix in WordPress/wordpress-develop#11585. |
Summary
multiple={ false }to theMediaUploadcomponent in the featured image panelContext
The
MediaUploadcomponent for the "Set featured image" button did not explicitly disable multiple selection. While theonDropFileshandler already hadmultiple: false, the media library modal itself allowed multi-select, which is confusing since only the first selected image would be used.Trac ticket: https://core.trac.wordpress.org/ticket/65053
Test plan