Forums

get_pages with no parent and no children (1 post)

  1. lerizzle
    Member
    Posted 6 months ago #

    I'm creating a custom post type (product). And it's hierarchical.

    I have a main product. Like "Tea brand name".

    Under that I have each individual tea.

    But sometimes I just have "coffee brand name" and no sub product cause thats the only one.

    So when I want to select all my products I want to select only the top level that have no children. So if I have 50 teas my search will only return "Tea Brand name", "coffee brand name" and not the 50 different flavours of the teas.

    I've been going back and forth trying to figure if "tea brand name" should be a taxonomy but for me it won't work cause I have another taxonomy called Teas. And since everyone knows the teas as "tea brand name" I need that to be my product.

    Anyways. What I need to a way to query my posts of that type that have no parent (easy 0) and have no children (hard part).

    Does anyone know if this is doable with the existing functions or will I have write my own select.

Reply

You must log in to post.

About this Topic