What’s new for Navigation in WordPress 6.2 and 6.3

This post was co-authored by @scruffian.

Since the last update, contributors have added many new features to the Navigation blockBlock 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. 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. 

For this reason, WordPress 6.2 added an editable “List View” component to the navigation block inspector controls which lays out the navigation structure with every item visible:

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 sidebarSidebar A 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 you click through to a Navigation you can:

  • Rename, duplicate and delete navigation.
  • Reorder items within a navigation.

Known limitation: currently you cannot add new items, but contributors are considering avenues to enable this for a future release.

One benefit of this view is that when multiple blocks all share the same navigation menuNavigation Menu A 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 “HeaderHeader The 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.

In WordPress 6.3, when editing a template part or a pattern that contains a navigation block, you will see any associated navigation menu displayed in the sidebar in an editable list view.

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. 

Moreover, by displaying the name of the navigation in the sidebar, it is immediately apparent which navigation menu is being used by the block. In the future it may be possible to complement this in a reciprocal way when viewing a single Navigation Menu by listing the templates where the navigation is used.

Automatic creation of Navigation fallbacks

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 new one 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.

With WordPress 6.3 however, this experience has been greatly improved with each Navigation block now being automatically assigned a navigation menu upon insertion. This means that once a block is ready, edits will not trigger further “loading” delays as changes are simply synchronized to the navigation menu already associated with the block.

Technical Implementation

This has been achieved by moving the majority of the fallback logic to the WordPress REST APIREST API The 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:

add_filter( 'wp_navigation_should_create_fallback', '__return_false' );

See the original PR for full details.

Other improvements

Performance

On top of the improvements to perceived performance delivered by improving the fallback navigation system, WordPress 6.3 also provides an additional enhancementenhancement Enhancements 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.

In #48683 contributors added the navigation endpoints to the list of endpoints that are preloaded in the editor. This means that when the editor loads the list of navigation menus will already be available to display and use within the block and/or Site View sidebar. 

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.

Bugs – we appreciate it if any bugs are reported on Github.

What’s next?

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 CoreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. SlackSlack Slack 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.

#6-3, #dev-notes, #dev-notes6-3, #navigation, #navigation-block