Skip to content

Navigation Link block keeps reference of post ID it was created with after URL gets changed #67643

@fabiankaegy

Description

@fabiankaegy

When you add a new navigation link block it technically also adds the id/postTyoe of the post/page it is linking to. This is used determine the active variation etc.

<!-- wp:navigation-link {"label":"XXX","type":"page","id":123,"url":"http://xxx.xx/xxx/","kind":"post-type"} /-->

The problem is that there is no way to unlink that navigation link block from that original post that was selected. And the ID also stays there.

So if you go into an existing navigation, update all the links and labels and then at some point delete/unpublish the original post with the ID that is still in the attributes, the navigation item will not get shown on the frontend anymore. This is because core rightly so wants to not show draft posts in the navigation.

The solution here would be to remove the id attribute when the URL gets manually changed by the user

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions