WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#10350 closed defect (bug) (worksforme)

post_parent returns 0 even when post is revised to give a parent

Reported by: petethebloke Owned by:
Milestone: Priority: low
Severity: normal Version: 2.8
Component: General Keywords: reporter-feedback
Focuses: Cc:

Description

I've added <?php echo $post->post_parent; ?> to a page and it shows 0 when on homepage (as expected). It shows 14 when on a subpage of 14, but on a different sub-page of 14 it shows 0. It seems it's getting the original parent before the page was revised to be a subpage of 14.

Change History (3)

comment:1 @dd326 years ago

Does it occur under the default theme with all plugins disabled?

Seems pretty unlikely WordPress would even render the object if the parent was set incorrectly at parsing time.. (but possible)

comment:2 @Denis-de-Bernardy6 years ago

  • Keywords reporter-feedback added
  • Milestone changed from Unassigned to 2.9

comment:3 @ryan6 years ago

  • Milestone 2.9 deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Closing pending feedback.

Note: See TracTickets for help on using tickets.