I’m trying to do something that seems pretty simple, but I’m running into issues. Basically I have a structure like the following:
— Texture 1
— Texture 2
These are item categories in a custom post type. So, on my home page, I’m trying to list all the TOP LEVEL terms in the taxonomy (Art and Textures) but ONLY show them if one or more of the child terms has a post assigned. No issues, there, except that the top-level term does not appear if it is not explicitly assigned to a post too. I want the user to be able to omit assigning ART to an ABSTRACT post (i.e. they should be able to assign ABSTRACT only) and for that to trigger showing ART on the home page.
Currently I get all or nothing. Specifying parent => 0 returns top-level, but only if that top level category has a post explicitly tied to it. Not defining parent => 0 gives me all the terms, which I don’t want.
Any advice would be greatly appreciated!
- The topic ‘Using get_terms to show top-level only, if children have posts’ is closed to new replies.