Make WordPress Core

Opened 2 months ago

Closed 2 months ago

Last modified 2 months ago

#64611 closed defect (bug) (fixed)

Snackbar notice shows wrong message when updating navigation menus in block editor

Reported by: juanfra's profile juanfra Owned by: westonruter's profile westonruter
Milestone: 7.0 Priority: normal
Severity: normal Version:
Component: Editor Keywords: has-patch
Focuses: Cc:

Description

When updating a navigation menu in the block editor, the snackbar notification displays the generic message "Post updated." instead of the more specific "Navigation Menu updated." message.

Steps to Reproduce

  1. Navigate to the Site Editor
  2. Edit a navigation menu (wp_navigation post type)
  3. Make changes and save
  4. Observe the snackbar notification

Expected behavior: The snackbar should display "Navigation Menu updated."

Actual behavior: The snackbar displays "Post updated."

Root Cause
The wp_navigation post type registration in wp-includes/post.php is missing the item_updated label in its labels array. The block editor's snackbar notification system uses this label from the REST API response to display the appropriate update message. Without this label, it falls back to the default "Post updated." message.

Solution
Add the item_updated label to the wp_navigation post type registration, following the same pattern used by other built-in post types like wp_template, wp_template_part, and wp_block (Patterns).

Change History (5)

This ticket was mentioned in PR #10882 on WordPress/wordpress-develop by @juanfra.


2 months ago
#1

  • Keywords has-patch added

Trac ticket: https://core.trac.wordpress.org/ticket/64611

This PR adds the missing item_updated label to the wp_navigation post type registration to fix the snackbar notification in the block editor showing "Post updated." instead of "Navigation Menu updated." when updating navigation menus.

### Testing

  1. Navigate to Site Editor
  2. Edit a navigation menu
  3. Make changes and save
  4. Verify the snackbar displays "Navigation Menu updated." instead of "Post updated."

https://github.com/user-attachments/assets/35ce0b6e-21d9-4625-9507-db4884fe775d

@westonruter commented on PR #10882:


2 months ago
#2

I tried to reproduce the issue, and it took me a bit to figure out how to do it. I had to make sure that I created a separate nav menu first. Then, I had to actually click into it in the main canvas to and make a change there, I couldn't make the change from the sidebar (e.g. by dragging):

https://github.com/user-attachments/assets/1a3d8f5b-c5ac-421c-b4c2-627648c8610e

#3 @westonruter
2 months ago

  • Milestone changed from Awaiting Review to 7.0
  • Owner set to westonruter
  • Status changed from new to reviewing

#4 @westonruter
2 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 61596:

Menus: Add item_updated label for wp_navigation post type.

This ensures the appropriate "Navigation Menu updated." message is shown in the snackbar after updating a navigation menu in the Site Editor. Without this, a generic "Post updated." message is displayed.

Developed in https://github.com/WordPress/wordpress-develop/pull/10882

Follow-up to [58055], [52145], [52069].

Props juanfra.
See #61095.
Fixes #64611.

@juanfra commented on PR #10882:


2 months ago
#5

Thanks for testing this and taking the time to figure it out, @westonruter!

Sorry about that, I'll make sure to be more precise next time.

Note: See TracTickets for help on using tickets.