WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#34628 closed defect (bug) (fixed)

Submenu items bump to top level upon save if parent nav menu item is newly inserted

Reported by: westonruter Owned by: westonruter
Milestone: 4.4 Priority: normal
Severity: normal Version: 4.3
Component: Customize Keywords: has-patch commit
Focuses: javascript Cc:

Description

Steps to reproduce:

  1. Open a menu in the Customizer.
  2. Add new new nav menu items.
  3. Drag one nav menu item to be a child of another.
  4. Do Save & Publish

Fail: notice that the sub-menu item gets bumped to the root level when the nav menu items are saved. This is only the case in the preview. If you reload the Customizer or visit the frontend after saving, the submenu item is in the expected nested location.

Demo: https://cloudup.com/cf5c7CV4cnG

Attachments (1)

34628.0.diff (1.8 KB) - added by westonruter 6 years ago.
https://github.com/xwp/wordpress-develop/pull/126/files

Download all attachments as: .zip

Change History (4)

#1 @westonruter
6 years ago

  • Keywords has-patch added

#2 @westonruter
6 years ago

  • Keywords commit added

When we get the inserted IDs for the new nav menu items back from the server upon save, we need to update each sub-nav menu item's menu_item_parent if it was a placeholder. See 34628.0.diff.

#3 @westonruter
6 years ago

  • Owner set to westonruter
  • Resolution set to fixed
  • Status changed from new to closed

In 35581:

Customize: Fix sub-nav menu items from appearing to bump to root level in preview upon saving.

This issue would appear when the parent nav menu item was also newly-inserted. The issue was only apparent in the prevew, as the actual data saved was correct. The menu_item_parent properties of the saved sub-nav menu items needed to get updated to refer to the newly-inserted parent nav_menu_item post IDs, as opposed to retaining the placeholder IDs.

Fixes #34628.

Note: See TracTickets for help on using tickets.