WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#11205 closed defect (bug) (fixed)

Behaviour when parent page is trashed is undefined

Reported by: sirzooro Owned by:
Milestone: 2.9 Priority: normal
Severity: normal Version: 2.9
Component: Trash Keywords: needs-patch
Focuses: Cc:

Description

Create two pages: Parent and Child. Set the former as a parent for the latter. Then trash Parent page. When you start editing the Child page, WP will display two notices:

Notice: Undefined offset: 1 in C:\wordpress29.local\wp-includes\post.php on line 2603
Notice: Trying to get property of non-object in C:\wordpress29.local\wp-includes\post.php on line 2603

It should be easy to remove these warnings. But there is another problem: when you save Child post, you will lost Parent-Child relation. Keep in mind that user may want to untrash the Parent page later.

Change History (5)

comment:1 ryan4 years ago

  • Component changed from Administration to Trash

comment:2 caesarsgrunt4 years ago

Odd - I don't get this error.

It is true, however, that editing the child of a trashed page loses the parent-child relation. I'm not sure what the alternative would be, however. Perhaps the parent could be shown in the list even if it is trashed, but that could be confusing. Maybe we need Jane's input here for the UI.

comment:3 sirzooro4 years ago

I have confirmed that these warnings appears with default theme and no active plugins. Make sure you have some fix for #11203 in place.

comment:4 caesarsgrunt4 years ago

Even with the fix for #11203 in place, I don't get the notices.

comment:5 azaozz4 years ago

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

(In [12279]) Get the right number of pages then excluding a tree, fixes #11205

Note: See TracTickets for help on using tickets.