Title: Get Parent-ID
Last modified: August 19, 2016

---

# Get Parent-ID

 *  [yonthebeach](https://wordpress.org/support/users/yonthebeach/)
 * (@yonthebeach)
 * [18 years ago](https://wordpress.org/support/topic/get-parent-id/)
 * Hi,
 * i have this structure:
 * HighestParentPage (id:4)
    — SubPage (id:5) — SubPage (id:6) — — SubSubPage (id:
   7) — — SubSubPage (id:8) — — — SubSubSubPage (id:9)
 * How can i retrieve the id of the HighestParentPage (id:4) when i am in ChildPage
   SubSubPage with id:8 ?? So two layers deeper.
 * thank you
    yavuz

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [yonthebeach](https://wordpress.org/support/users/yonthebeach/)
 * (@yonthebeach)
 * [18 years ago](https://wordpress.org/support/topic/get-parent-id/#post-742106)
 * no one idea?
 * thanks
    yavuz
 *  [cgarcia109](https://wordpress.org/support/users/cgarcia109/)
 * (@cgarcia109)
 * [17 years, 6 months ago](https://wordpress.org/support/topic/get-parent-id/#post-742321)
 * $current = $post;
    //while has parent while($current->post_parent) { $current
   = get_post($current->post_parent); } // $current should have the top most parent

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Get Parent-ID’ is closed to new replies.

## Tags

 * [child page](https://wordpress.org/support/topic-tag/child-page/)
 * [parent id](https://wordpress.org/support/topic-tag/parent-id/)

 * 2 replies
 * 2 participants
 * Last reply from: [cgarcia109](https://wordpress.org/support/users/cgarcia109/)
 * Last activity: [17 years, 6 months ago](https://wordpress.org/support/topic/get-parent-id/#post-742321)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
