WordPress 6.8 brings a range of smaller yet meaningful updates to the 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. editor that enhance consistency, improve developer experience, and refine default behaviors. These changes include refinements to the Navigation block’s class and markup handling, a new filter Filters are one of the two types of Hooks https://codex.wordpress.org/Plugin_API/Hooks. They provide a way for functions to modify data of other functions. They are the counterpart to Actions. Unlike Actions, filters are meant to work in an isolated manner, and should never have side effects such as affecting global variables and output. for customizing visible post statuses, and updates to the behavior of the iframe iFrame is an acronym for an inline frame. An iFrame is used inside a webpage to load another HTML document and render it. This HTML document may also contain JavaScript and/or CSS which is loaded at the time when iframe tag is parsed by the user’s browser. and LinkControl components. You will also notice stabilization of previously experimental features, improved block registration requirements, and changes that prepare the block editor for broader extensibility and UI User interface consistency moving forward. This post highlights these miscellaneous updates that don’t warrant individual dev notes 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. but are still important to be aware of when building with or extending the block editor.
Table of Contents
Customizable Post Status Visibility in Navigation Block Links
The Navigation block now supports filtering of the post statuses of Posts shown in the Navigation on the front of the site. The new filter render_block_core_navigation_link_allowed_post_status
defaults to publish
but that list can be extended via the hook:
add_filter(
'render_block_core_navigation_link_allowed_post_status',
static function(array $post_status): array {
$post_status[] = 'private'; // append statuses to the array of default statuses.
return $post_status;
} );
For more information, visit #63181.
The Navigation block’s handling of the current-menu-ancestor
CSS Cascading Style Sheets. class has been updated for improved consistency. Previously, the current-menu-item
class was applied to the <li>
element of the current menu item, while the current-menu-ancestor
class was applied to the <a>
element of ancestor items. This inconsistency posed challenges for developers aiming to style navigation menus uniformly. With the changes introduced in #67169, both classes are now applied to their respective <li>
elements, ensuring a consistent and predictable structure for styling purposes.
Key Change:
- The
current-menu-ancestor
class is now applied to the <li>
element of ancestor menu items, aligning its behavior with that of the current-menu-item
class.
Implications for Developers:
- This update standardizes the application of CSS classes within the Navigation block, simplifying the process of targeting and styling current and ancestor menu items.
- Developers should review and adjust any custom styles or scripts that rely on the previous application of the
current-menu-ancestor
class to ensure compatibility with this change.
By implementing this adjustment, WordPress 6.8 enhances the consistency and reliability of its Navigation block, facilitating more intuitive and maintainable menu styling for developers.
Consistent Markup for Navigation Item Labels
The Navigation block has been updated to enhance consistency between navigation items and submenu items. Previously, navigation items containing submenus lacked the <span class="wp-block-navigation-item__label">
wrapper around the navigation item text, which was present in standard navigation items. This inconsistency made styling and scripting more challenging for developers. With the changes introduced in #67198, both navigation items and submenu items now include this <span>
wrapper, ensuring uniform markup structure across all navigation elements.
Key Changes:
- Consistent Markup: All navigation items, including those with submenus, now wrap the item text within a
<span class="wp-block-navigation-item__label">
element.
Implications for Developers:
- Simplified Styling: The uniform use of the
<span>
wrapper allows for more straightforward and consistent CSS targeting of navigation item labels.
- Enhanced Scripting: Developers can now reliably select and manipulate navigation item labels using JavaScript JavaScript or JS is an object-oriented computer programming language commonly used to create interactive effects within web browsers. WordPress makes extensive use of JS for a better user experience. While PHP is executed on the server, JS executes within a user’s browser. https://www.javascript.com/., regardless of whether the item contains a submenu.
By standardizing the markup structure of navigation items, WordPress 6.8 improves the developer experience when customizing and extending navigation menus.
Stabilize the isPreviewMode
settings flag
The isPreviewMode
settings flag is now stable, and using select( ‘core/block-editor’ ).getSettings().__unstableIsPreviewMode
will now log a deprecation warning.
This public flag is commonly used to disable behaviors that cannot be used when rendering block or template previews. A good example is keyboard shortcuts.
For more information, visit #66149.
Iframed Content: Always enable for block themes
Continuing the effort to use iframed content in the post editor initiated in WP 5.9. Starting from WP 6.8, the editor will always render iframed content for block themes. This behavior was only enabled when using the Gutenberg The Gutenberg project is the new Editor Interface for WordPress. The editor improves the process and experience of creating new content, making writing rich content much simpler. It uses ‘blocks’ to add richness rather than shortcodes, custom HTML etc. https://wordpress.org/gutenberg/ plugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party.
Edited April 1, 2025: This changeset was reverted #69778.
Block registration: Normalize blockType.parent
to an array
The block registration 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. now enforces the parent
setting to be an array
. The editor will now display a warning if it’s a different type, such as a `string`.
For more information, visit #66250.
Stabilized LinkControl component
The LinkControl
component, which has been in an experimental state for several years, is being stabilized in WordPress 6.8. This change affects plugin developers who are using the __experimentalLinkControl
component in their custom blocks or extensions.
For backwards compatibility, the __experimentalLinkControl
import will continue to work but will display deprecation warnings.
In addition, the following sub components have been deprecated:
__experimentalLinkControlSearchInput
__experimentalLinkControlSearchResults
__experimentalLinkControlSearchItem
For more information, visit #56384.
Changes to the Iframe Component
WordPress 6.8 changed the behavior of the scale prop on the Iframe component. This change may affect existing code.
Code using the following pattern may be affected:
import { __unstableIframe as Iframe } from '@wordpress/block-editor';
<Iframe scale="default" />
If you want to use autoscaling, change scale="default"
to scale="auto-scaled"
.
For more information, visit #66280.
Co-authored by @jeffpaul
Props to @jeffpaul @mamaduka @fabiankaegy for review.
#6-8, #dev-notes, #dev-notes-6-8