If The Post Has a Term…
Before actually looking at code for how to do this, I think it’s helpful to outline what it is that we’re actually going to do:
- We’re going to load up all of the terms that exist for a given post type
- For each term, we’ll determine if the term has a child
- If the post has a child, we need to determine if the term is actively applied to the post
- If the term if applied to the post, we’ll store it in one index of an array
- Otherwise, we’ll store it in a different index of the array
To find out more about this continue reading here!