[wp-trac] [WordPress Trac] #50435: In some cases wp_get_post_parent_id() = get_post_ancestors
WordPress Trac
noreply at wordpress.org
Fri Jun 19 21:00:44 UTC 2020
#50435: In some cases wp_get_post_parent_id() = get_post_ancestors
--------------------------+-----------------------------
Reporter: chvon7thal | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 5.4.2
Severity: normal | Keywords:
Focuses: performance |
--------------------------+-----------------------------
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;
--
Ticket URL: <https://core.trac.wordpress.org/ticket/50435>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list