Home › Forums › General Issues › ACF relationship field group by taxonomy › Reply To: ACF relationship field group by taxonomy
In your relationship field you set it to return an array of post ID values. Then in your template you do 2 queries using the value for “post__in” being the value returned by the relationship field and add a tax_query to each of these queries so that you only get the posts in each term. Then you loop over the posts returned for each of these queries.
Alternately, you create two separate relationship fields and only select the correct posts for each section to be displayed. This works out the same as the first options but you don’t need to do the queries yourself.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.