Opened 5 years ago
Last modified 5 years ago
#50435 new defect (bug)
In some cases wp_get_post_parent_id() = get_post_ancestors
Reported by: | chvon7thal | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 5.4.2 |
Component: | Posts, Post Types | Keywords: | |
Focuses: | performance | Cc: |
Description
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;
Note: See
TracTickets for help on using
tickets.