Skip to content

Navigation Link: Use dynamic URL and label at render time and sync label in editor#79846

Open
dhruvikpatel18 wants to merge 4 commits into
WordPress:trunkfrom
dhruvikpatel18:fix/dynamic-navigation-item-title
Open

Navigation Link: Use dynamic URL and label at render time and sync label in editor#79846
dhruvikpatel18 wants to merge 4 commits into
WordPress:trunkfrom
dhruvikpatel18:fix/dynamic-navigation-item-title

Conversation

@dhruvikpatel18

@dhruvikpatel18 dhruvikpatel18 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

What?

Closes #38253
This PR fixes the core/navigation-link block so that navigation menu items always reflect the current permalink and title of the linked post, page, or taxonomy term, both on the frontend and in the Site Editor.

Why?

When a navigation menu item is added via the Site Editor, its url and label are stored as block attributes at save time. If a post's title or slug is later changed, the menu item continued to show the old URL and label, with no automatic update. This was reported in #38253.

Even when WordPress could redirect the old URL, it is better to output the correct link from the start so it works without relying on redirects.

Testing Instructions

  1. Create a new Page titled "Test Page" with slug test-page and publish it.
  2. Go to Appearance → Editor → Navigation and add "Test Page" as a navigation menu item.
  3. Save the navigation menu.
  4. Go back and edit the page: change its title to "My Changed Page" and its slug to my-changed-page. Update/publish.
  5. Confirm the changed page title in frontend and site editor as well.

Screenshots or screencast

Screen.Recording.2026-07-03.at.4.01.12.PM.mov

@github-actions github-actions Bot added the [Package] Block library /packages/block-library label Jul 3, 2026
@dhruvikpatel18
dhruvikpatel18 marked this pull request as ready for review July 5, 2026 10:50
@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Required label: Any label starting with [Type].
  • Labels found: [Package] Block library.

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

@github-actions

github-actions Bot commented Jul 5, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: dhruvikpatel18 <dhruvik18@git.wordpress.org>
Co-authored-by: TimothyBJacobs <timothyblynjacobs@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

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

Labels

[Package] Block library /packages/block-library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Menu items used fixed URL/title when a dynamic link is available

1 participant