Reputation: 3622
I'm trying to get the parent ID of a page. I've searched around but the only things I can find on this get the top level parent ID.
I have 3 layers of pages:
-page 1
-------page 2
-------------page 3
page 3 is a child of page 2, page 2 is a child of page 1.
If I'm currently on the page 3 page how can I get the ID of the page directly above it? (page 2)
Appreciate any help!
Upvotes: 0
Views: 791
Reputation: 874
With in the global $post you can simply do is use
$post->post_parent
Upvotes: 2