Home › Forums › General Issues › Sorting Relationship Field Entries by Custom Tax Terms › Reply To: Sorting Relationship Field Entries by Custom Tax Terms
I would do it like this. Get the relationship field without formatting, this will return an array of post IDs
$associated_downloads = get_field('associated_downloads', false, false);
and the query args would look something like this
$args = array(
'post_type' => 'downloads',
'post_status' => 'publish',
'tax_query' => array(
array(
'taxonomy' => 'download_category',
'field' => 'slug',
'terms' => $custom_term->slug
)
),
'post__in' => $associated_downloads
);
Which should get the post selected in a specific term
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.