Skip to content

Preserve the navigation on theme switch #38291

@adamziel

Description

@adamziel

Switching from Twenty Twenty-Two to another block theme resets the navigation.

Technically, it's because the navigation data is stored inside the template parts, for example:

<!-- wp:navigation {"layout":{"type":"flex","justifyContent":"right","orientation":"horizontal"}} -->
     <!-- wp:page-list /-->
<!-- wp:navigation /-->

The next theme is not aware of any customizations made and comes with its own presets. One theme I saw was preset to render a classic menu:

<!-- wp:navigation {"__unstableLocation":"primary"} -->
<!-- wp:navigation /-->

A different approach would be to infer the location/slug from the surrounding templates / template parts and use that to infer the new localization for the menu.

Prior discussions:


When this is implemented we should also consider the implications of #42600

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions