Global Styles: Add support to use Featured Image as background image#77412
Global Styles: Add support to use Featured Image as background image#77412dhruvikpatel18 wants to merge 1 commit intoWordPress:trunkfrom
Conversation
| // eslint-disable-next-line @wordpress/data-no-store-string-literals | ||
| const { getEditedPostAttribute } = select( 'core/editor' ); | ||
| // eslint-disable-next-line @wordpress/data-no-store-string-literals | ||
| const { getMedia } = select( 'core' ); |
There was a problem hiding this comment.
Using string store access intentionally to avoid importing @wordpress/editor, which caused memory issues in this component due to heavy dependencies. This follows a pattern used in performance-sensitive areas of Gutenberg.
If there is a preferred or safer alternative to accessing this data without introducing performance overhead, guidance would be appreciated.
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
|
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. |
Part of: #54336
What?
Adds a "Use Featured Image" option to the Background Image control, similar to the behavior available in the Cover block.
When selected, the control uses the post’s featured image as the background image and reflects it in both the inspector preview and the block rendering.
Why?
Currently, the Background Image control only allows selecting or uploading an image manually. However, other blocks like the Cover block already support using the post’s featured image directly.
Adding this option:
Testing Instructions
Screenshots or screencast
Screen.Recording.2026-04-16.at.12.54.43.PM.mov
Use of AI Tools
AI assistance Claude was used to help reason about Gutenberg data flow and implementation approach. All code and logic have been reviewed, tested, and validated manually.