WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 2 years ago

#41727 new defect (bug)

Draft page loses its hierarchy on save when other pages are drafts in hierarchy

Reported by: stode Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.8.1
Component: Posts, Post Types Keywords: reporter-feedback
Focuses: administration Cc:
PR Number:

Description

How to reproduce:

  1. Create a set of pages with a status publish
  2. Set hierarchy to pages
  3. Change the status to of the aforementioned set to draft
  4. Open draft for editing.
  5. Save as draft.
  6. Now you have lost the hierarchy.

I think you should retain the hierarchy, because it is quite common use case to build something as drafts before publishing them or taking pages to drafts if they are in need for editing and the user wants them out before edits are done. Tickets possibly related #15541 and #12890.

Change History (4)

#1 follow-up: @subrataemfluence
2 years ago

To my understanding this is logical enough. Say we have 4 pages, Page 1 (no parent), Page 2 (Parent: Page 1), Page 3 (Parent: Page 2) and Page 4 (Parent: Page 3). As long as they are all "Published" you can use them as parents of another page.

Now, if we update status of Page 2 to Draft, if immediately gets publicly inaccessible and thus cannot be used as a Parent of Page 3. In this scenario, you lose the ability to use Page 3 as a parent of Page 4.

Meaning if you go bottom up, the immediate parent of a page has to be the children of its immediate parent and that has to be Published. So, if the top most Page in the hierarchy is a Draft, all pages in the tree will lose their parent-child relationship.

In short, if you make the page at top most level Draft, all pages in its tree will lose the hierarchy, but if you make a page Draft inside the tree (not the top most one), you would still be able to use the hierarchy for pages under it, but the page you just made Draft, won't come up in the dropdown.

Let me try to create an example:

  1. Page 2 is made Draft - No page under it (3 and 4) won't be able to use it as their parent any more
  1. Page 3 is made Draft: Page 2 will never suffer as Page 1 still its parent, but when Editing Page 4, you won't be able to see Page 3 in the dropdown, rather you would see Main page, Page 1 and Page 2. Also, in this situation there will no default selection in the dropdown as you have made its immediate parent Draft. If you do not select a Parent at this stage, the page would be saved as a top level page (with no parent).

I am not sure whether my explanation and examples could clear up the logical part of it by 100%, but I hope it will let you understand about the Parent-Child relationship and how they (should) work.

#2 @subrataemfluence
2 years ago

  • Keywords reporter-feedback added

#3 in reply to: ↑ 1 ; follow-up: @stode
2 years ago

I understand that basic logic very well. I still think if I go an edit the drafts that before editing have the hierarchy intact, should not lose it if the status of the post is not changing.

There could be some kind of warning of losing the hierarchy.

#4 in reply to: ↑ 3 @subrataemfluence
2 years ago

I agree with the warning part.

Replying to stode:

I understand that basic logic very well. I still think if I go an edit the drafts that before editing have the hierarchy intact, should not lose it if the status of the post is not changing.

There could be some kind of warning of losing the hierarchy.

Note: See TracTickets for help on using tickets.