Support

Account

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