7 responses to “Figuring out if a WordPress page is descendant from another”

  1. Jason King

    Thanks, that code worked a treat. Absolutely agree that WordPress needs conditional tags such as is_child and is_descendant. In the meantime, it’s good to know we can create our own functions to do the task.

  2. alesub

    Amazing, exactly what I needed! Hope they add the tag on the next releases.


  3. Ryan Fitton

    Great advice, i’m currently using the second option. I’m using it because i’m converting my original website into a wordpress theme so that i can use it as a CMS :) it’s been tough but i’ve nearly finished it.

    This post has helped a lot and thank you :D

  4. Tim Houghton

    Thanks, just what I needed! Funnily enough for almost the exact same purpose as you, except my ancestors are all the same homepage but in different languages. So I only want to show the child items that are in the correct language.

  5. Casey Haley

    Brilliant post! Know if this has been implemented in the wordpress core yet?

  6. Markus

    Thank you exactly what I needed! Simple and clear…

Leave a Reply