WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 11 months ago

#19038 new defect (bug)

Menu Items aren't deleting on page being trashed, only when deleted

Reported by: jeremyatignition Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.2.1
Component: Menus Keywords: has-patch dev-feedback
Focuses: Cc:

Description

The linked menu item for a page isn't removed when the page is trashed.

Attachments (1)

19038.diff (596 bytes) - added by solarissmoke 2 years ago.

Download all attachments as: .zip

Change History (4)

comment:1 solarissmoke2 years ago

  • Keywords has-patch dev-feedback added; needs-patch removed

This is because _wp_delete_post_menu_item is only hooked to the delete_post action.

Patch adds the same hook to the trash action. Of course this means that if you restore the post then the menu item has to be restored manually if you still want it - but this seems better than having to delete the menu item manually when you trash a post.

solarissmoke2 years ago

comment:3 jpyper11 months ago

Just wanted to say this works like a charm for me. I can even add that line into a plugin or my functions.php file.

Note: See TracTickets for help on using tickets.