I found a solution by using a custom query and then grouping it with the term name:
1 2 3 4 5 6 7 8 9 10 11 | SELECT * FROM wp_term_taxonomy AS cat_term_taxonomy INNER JOIN wp_terms AS cat_terms ON cat_term_taxonomy.term_id = cat_terms.term_id INNER JOIN wp_term_relationships AS cat_term_relationships ON cat_term_taxonomy.term_taxonomy_id = cat_term_relationships.term_taxonomy_id INNER JOIN wp_posts AS cat_posts ON cat_term_relationships.object_id = cat_posts.ID INNER JOIN wp_postmeta AS meta ON cat_posts.ID = meta.post_id WHERE cat_posts.post_status = 'publish' AND meta.meta_key = 'active' AND meta.meta_value = 'active' AND cat_posts.post_type = 'member' AND cat_term_taxonomy.taxonomy = 'member_groups' |
Then by just using a regular foreach query I can just extract the information I want. But I’m still interested in another way if there is, maybe by using WordPress’ own functions.
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.