Make WordPress Core

Opened 4 years ago

Last modified 4 years ago

#50435 new defect (bug)

In some cases wp_get_post_parent_id() = get_post_ancestors

Reported by: chvon7thal's profile chvon7thal Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.4.2
Component: Posts, Post Types Keywords:
Focuses: performance Cc:


Using wp_get_post_parent_id() while parsing gutenberg blocks in a save_post action, I found out, that when a parent page exists, and parent_id is the actual published post wp_get_post_parent_id() gives back the post_id of the parent page.

A turn around seems to be ($postParent == $postId) ? $post_current_ID : $postId;

Change History (1)

#1 @SergeyBiryukov
4 years ago

  • Component changed from General to Posts, Post Types
Note: See TracTickets for help on using tickets.