Skip to content
Merged
Prev Previous commit
Next Next commit
Toggle off featured image when doing other things
  • Loading branch information
andrewserong committed Nov 19, 2025
commit c13fd67c660d2fb19242e3094df42be6db1f5412
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ export default function Media( { data, field } ) {
caption: '',
alt: '',
};
// Turn off featured image when resetting
if ( hasFeaturedImageSupport ) {
resetValue.featuredImage = false;
}
// Merge with existing value to preserve other field properties
updateAttributes( { ...value, ...resetValue } );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would the plan be to make these use field.setValue in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! While troubleshooting, I found it easier for this PR to just pop updateAttributes in here for now, but I'd like to refactor this in a follow-up, too

} }
Expand Down Expand Up @@ -211,6 +215,11 @@ export default function Media( { data, field } ) {
newValue.poster = selectedMedia.poster;
}

// Turn off featured image when manually selecting media
if ( hasFeaturedImageSupport ) {
newValue.featuredImage = false;
}

// Merge with existing value to preserve other field properties
const finalValue = { ...value, ...newValue };
updateAttributes( finalValue );
Expand Down
Loading