The WordPress coreCoreCore is the set of software required to run WordPress. The Core Development Team builds WordPress. development team builds WordPress! Follow this site for general updates, status reports, and the occasional code debate. There’s lots of ways to contribute:
Found a bugbugA bug is an error or unexpected result. Performance improvements, code optimization, and are considered enhancements, not defects. After feature freeze, only bugs are dealt with, with regressions (adverse changes from the previous version) being the highest priority.?Create a ticket in the bug tracker.
Since the last update, contributors have added many new features to the Navigation blockBlockBlock 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. and also the wider navigation management system within WordPress.
These improvements are designed to help users manage their navigation menus and provide a more consistent and reliable experience.
Let’s take a look at what’s changed…
Navigation List View
One aspect of the navigation block is that parts of it are often hidden – for example submenus aren’t always open. This can make managing the items within a navigation block in the editor canvas challenging.
In addition to the standard block tools, the list view allows all the usual ways of managing navigation items. You can:
Add and remove navigation items.
Reorder navigation items.
Create new submenus.
Adding this feature to the block also prepared the groundwork to allow contributors to unlock several exciting new features in WordPress 6.3.
Navigation in Site View
With WordPress 6.3, it is now possible to manage your navigation from outside of the context of a Navigation block and without needing to edit a template.
When in the Site Editor a new “Navigation” section is available within the Site View sidebarSidebarA sidebar in WordPress is referred to a widget-ready area used by WordPress themes to display information that is not a part of the main content. It is not always a vertical column on the side. It can be a horizontal rectangle below or above the content area, footer, header, or any where in the theme. which lists all of your navigation menus and allows you to manage them without having to find the templates (and blocks) they are used within:
One benefit of this view is that when multiple blocks all share the samenavigation menuNavigation MenuA theme feature introduced with Version 3.0. WordPress includes an easy to use mechanism for giving various control options to get users to click from one place to another on a site., the user now has a single place to manage the menu items.
Focus Mode for Navigation
Surfacing navigation as a list within the Site View is excellent for simple use cases, but sometimes it’s useful to see the navigation within the editor canvas to better visualize the changes being made.
For this reason WordPress 6.3 sees the addition of “Focus Mode” for Navigation whereby the navigation menu is displayed within an editor canvas completely isolated from any surrounding site context.
You can access this new mode by clicking on the “Edit” button within the Navigation block’s toolbar, or by browsing to an individual navigation from the “Navigation” section of the Site View sidebar.
Focus mode provides full scope to modify the blocks that are inside the navigation block (the “menu items”), allowing you to add new items and even make use of the editable list view in the block’s sidebar:
It is important to note that as a given navigation menu may be used across multiple block’s on a site – each of which will have their own place within the overall design of your site – the ability to change the visual representation of the Navigation block itself has been intentionally disabled.
This allows you to focus soley on the contents of the navigation menu.
Another benefit of this feature is that it is now possible to access and edit the inner blocks of a navigation simply by switching the editor to “code view” mode:
Managing your navigation in isolation can be extremely useful, but sometimes it’s handy to see your navigation menu within the context of which it is being displayed. This is precisely what the next feature seeks to address.
Navigation in Patterns and Template Parts
Patterns and Template Parts often contain navigation block’s. The classic example of this is a “HeaderHeaderThe header of your site is typically the first thing people will experience. The masthead or header art located across the top of your page is part of the look and feel of your website. It can influence a visitor’s opinion about your content and you/ your organization’s brand. It may also look different on different screen sizes.” template part containing a site logo block and a navigation block.
This gives you quick access to manage the navigation that is used in the canvas without needing to switch to editing the block directly within the canvas itself.
Previous versions of WordPress had the concept of a “fallback” Navigation which was utilized in scenarios where a Navigation block has no navigation menu associated with it.
Depending on whether the site had existing Navigation Menus, the mechanism would either fetch an existing navigation or create a newone from scratch.
However the implementation provided a suboptimal user experience, with a noticeable loading delay upon block modification caused by fetching/creating the (“fallback”) navigation menu to be associated with the block.
This has been achieved by moving the majority of the fallback logic to the WordPress REST APIREST APIThe REST API is an acronym for the RESTful Application Program Interface (API) that uses HTTP requests to GET, PUT, POST and DELETE data. It is how the front end of an application (think “phone app” or “website”) can communicate with the data store (think “database” or “file system”) https://developer.wordpress.org/rest-api/.. A new dedicated “Navigation Fallback” endpoint now immediately returns the most “suitable” fallback navigation menu for your site.
What does “suitable” mean? This is much the same as for WordPress 6.2, namely when called the endpoint…
Returns the most recently created existing Navigation Menu.
(if not available then…) Returns a Navigation Menu created from the most recently created Classic Menu (note: this is a one time import, and changes to the original Classic Menu are not synced to the block-based Navigation Menu).
(if not available then…) Creates and returns a new Navigation Menu, typically comprising a list of the current site’s Pages.
This heuristic may evolve in future releases to allow the fallback to be sensitive to the context in which it is being displayed. For now however, the improvement to the block’s user experience and reliability is a welcome improvement over previous versions.
Opting out of automatic fallback creation
If you’d like to opt out of automatic creation of Navigation fallbacks you can use the wp_navigation_should_create_fallback hook as follows:
On top of the improvements to perceived performance delivered by improving the fallback navigation system, WordPress 6.3 also provides an additional enhancementenhancementEnhancements are simple improvements to WordPress, such as the addition of a hook, a new feature, or an improvement to an existing feature. to the performance of the navigation system.
This simple change makes it possible to access and manage your navigation, which is a key facet of most websites and makes for a greatly improved user experience.
Login/Logout
It is common for websites to provide a login and logout link for their users. In #49160 we added this block to the list of blocks that are allowed within the navigation block so that users can add this functionality to their navigation.
What do you think?
This concludes our brief overview of the key changes to the navigation system in WordPress.
As always we are open to your feedback. What do you think? Are these improvements impactful for you? What is missing and what you would like to see? Your thoughts are appreciated in the comments below.
Of course, whilst there has been much progress contributors recognise that there is still much to do.
Our focus for future releases will be updated on the relevant Tracking Issue and we encourage you all to take a look and let us know any feedback you might have on the proposals outlined there.
You can also join us on WP CoreCoreCore is the set of software required to run WordPress. The Core Development Team builds WordPress.SlackSlackSlack is a Collaborative Group Chat Platform https://slack.com/. The WordPress community has its own Slack Channel at https://make.wordpress.org/chat/. (sign up required) in the #feature-website-navigation channel.
Props to @scruffian who co-authored this post and to @draganescu and @annezazu for review.