WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#13154 closed defect (bug) (fixed)

Editing Menus causes pages/posts to be deleted.

Reported by: kgraeme Owned by: filosofo
Milestone: 3.0 Priority: high
Severity: critical Version: 3.0
Component: Menus Keywords: nav-menu
Focuses: Cc:

Description

When editing menus I have had it delete Pages and Posts. Haven't specifically reproduced the steps, but in this case Hello World was in the menu. I tried doing a search for Hello World again just to add another instance of it, and it didn't show up in search. Then it just disappeared from the menu.

Same basic thing happened later with the About page.

Haven't been able to reproduce it in a forced attempt.

Attachments (2)

verify_nav_menu_items_ontology.diff (5.0 KB) - added by filosofo 5 years ago.
wp3.0-nav-menu-post-error.png (14.7 KB) - added by kpdesign 5 years ago.

Download all attachments as: .zip

Change History (13)

comment:1 @filosofo5 years ago

  • Status changed from new to accepted

comment:2 follow-up: @DeannaS5 years ago

Note that when the pages/posts are deleted, they are still in the database but have had their type changed to nav_menu_item.

I have had it happen also, but haven't been able to reproduce.

comment:3 @nacin5 years ago

  • Milestone changed from Unassigned to 3.0

comment:5 @filosofo5 years ago

Note on the patch: it adds several checks make sure a nav_menu_item is actually being acted on, before updating it as such. That should avoid the error some are seeing, although we haven't yet been able to get reproducible steps.

comment:6 follow-up: @kpdesign5 years ago

  • Cc kpdesign added
  • Keywords nav-menu added
  • Version set to 3.0

I found this same error yesterday AM, but did not have time then to file a ticket.

Here are the steps that I took that produced the error:

  1. Add new menu; save.
  2. Add existing Hello World post to menu. Click Edit to see fields in menu item - default title (Menu Item) remained, but URL and title attribute fields are blank instead of showing post title and URL.
  3. With fields left blank, click Save Menu. Post chosen to be in the menu is deleted. Had to go to Trash to restore it.

The same thing happened with the About page.

I have applied the patch on this ticket to my updated dev install this AM. The post/page is no longer being deleted, so the checks put into place seem to have fixed that issue.

However, the issue in step 2 above (adding a post to the nav menu) is still happening - default title remains, URL and title attribute fields are blank (see attached screenshot). Steps/result follow:

  1. Add custom link to menu, then add a post to menu. Fields for post are blank.
  2. Add page to menu, then add a post to menu. Fields for post are filled in properly sometimes; other times they are still blank.
  3. Add post first. Fields are blank.
  4. Add category or tag to menu, then add a post to menu. Fields for post are blank.

Side note: I am able to add the same post/page/category/tag/etc. multiple times to the menu. Bug or intended behavior?

comment:7 in reply to: ↑ 6 @filosofo5 years ago

Replying to kpdesign:

However, the issue in step 2 above (adding a post to the nav menu) is still happening - default title remains, URL and title attribute fields are blank (see attached screenshot). Steps/result follow:

We're working on changes to the behavior when you add a menu item.

Side note: I am able to add the same post/page/category/tag/etc. multiple times to the menu. Bug or intended behavior?

It's allowed behavior.

comment:8 in reply to: ↑ 2 @kgraeme5 years ago

Replying to DeannaS:

Note that when the pages/posts are deleted, they are still in the database but have had their type changed to nav_menu_item.

I have had it happen also, but haven't been able to reproduce.

They were deleted from the database for me. But I think if I still had the item listed in the menu, I would see the same thing as you're seeing. But if I remove the menu item, then no reference to the original page is left in the DB.

comment:9 @uglyrobot5 years ago

Possibly related:
13174

comment:10 @dickie5 years ago

I have also had this happen, glad there is a ticket for it, as I could not remember for the life of me how to make it happen. It worried the hell out of me at the time, as the pages just vanished.

comment:11 @filosofo5 years ago

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

This has been fixed for a while, from a big patch a couple of weeks ago.

Note: See TracTickets for help on using tickets.