Support » Fixing WordPress » Getting the midlevel parent of a child

  • Hi guys,

    I have a several levels of children pages with their own children like this:

    Research > Topic 1 > Page 1
    Research > Topic 2 > Page 2

    Once in Page 1 or Page 2, I need to get the 2nd level page, aka Topic 1 or Topic 2, NOT Research.

    Yet when I do echo $post->parent it spits out Research, but I need to get to Topic 1.

    How do I do get to the midlevel parent and not the root parent?

    Thanks!
    K

  • The topic ‘Getting the midlevel parent of a child’ is closed to new replies.