Timeline for tax_query: Don’t show posts with parent term when they have a corresponding child term applied
Current License: CC BY-SA 4.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 14, 2019 at 11:46 | comment | added | majick |
you're welcome. I come on here for questions to challenge myself with. :-) the get_term_children function description in the codex implies it will accept a term object as the first argument but whatever works.
|
|
Oct 14, 2019 at 11:42 | history | edited | majick | CC BY-SA 4.0 |
added 9 characters in body
|
Oct 14, 2019 at 11:38 | comment | added | user1706680 |
Thanks – I really appreciate your effort. Just one last thing: I also needed to change $term to $term->term_id in the same line.
|
|
Oct 14, 2019 at 11:07 | comment | added | majick | All good it needed the challenge. You did well to describe it in a few different ways, I just had to reread it quite a few times to really get it, it's not an easy query to get one's head around. Glad it actually worked! I edited it to add the taxonomy. :-) | |
Oct 14, 2019 at 11:03 | history | edited | majick | CC BY-SA 4.0 |
added 11 characters in body
|
Oct 14, 2019 at 10:01 | vote | accept | user1706680 | ||
Oct 14, 2019 at 10:01 | comment | added | user1706680 |
Sorry for breaking you brain … English is not my first language and sometimes it’s a bit difficult to explain things properly. But many thanks for helping and pointing my brain in the right direction. :D I just needed to change the line 'terms' => get_term_children($term), to 'terms' => get_term_children( $term->term_id, $taxonomy ) . Now your code works perfectly! Thanks a lot!
|
|
Oct 13, 2019 at 7:35 | history | answered | majick | CC BY-SA 4.0 |