Expanding on previously implemented block Block is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience. supports in WordPress 5.6 and 5.7, WordPress 5.8 introduces several new block
supports flags and new options to customize your registered blocks.
color._experimentalDuotone – Adding duotone support to your block is a new experimental feature. To test, set this property to a string that specifies the CSS Cascading Style Sheets. selector where you want to apply duotone. For example, in your block metadata:
_experimentalDuotone: '> .duotone-img'
color.link – Support for link color was added, this mirrors the usage and support for
color.text that was added in WP 5.6.
To use in your block, add the supports flag in the block metadata:
You can define a default value, using attributes and it will also use the values set in
theme.json if present. For example:
Related ticket Created for both bug reports and feature development on the bug tracker.: #31524
Stabilized Supports API An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways.
Two features that were experimental in WordPress 5.7 have been stabilized in WordPress 5.8
See Block Supports API documentation for usage details.
The spacing support was updated and expanded to work for server-side blocks, as well as adding granular support to configure spacing for sides (
left) individually. For example:
margin: true, // Enable margin UI control.
padding: true, // Enable padding UI control.
The following example configures side support for just
margin: [ 'top', 'bottom' ], // Enable margin for arbitrary sides.
padding: true, // Enable padding for all sides.
supports can target specific blocks using
theme.json, or it’s own attributes. For example, customizing the
bottom margins for the
Props to @mkaz and @nosolosw for help with compiling this dev note Each important change in WordPress Core is documented in a developers note, (usually called dev note). Good dev notes generally include a description of the change, the decision that led to this change, and a description of how developers are supposed to work with that change. Dev notes are published on Make/Core blog during the beta phase of WordPress release cycle. Publishing dev notes is particularly important when plugin/theme authors and WordPress developers need to be aware of those changes.In general, all dev notes are compiled into a Field Guide at the beginning of the release candidate phase..
Related PRs: #31808, #31332
Tags: #5.8 #dev-notes #gutenberg