Support

Account

Home Forums General Issues Sort Custom Post Type by Taxonomy. Reply To: Sort Custom Post Type by Taxonomy.

  • You need to add a posts__in argument that uses the post object field value.

    
    // get the unformatted value of the field by setting
    // third argument to false, returns array of posts IDs
    $products = get_field('products_in_this_auction', false false);
    
    $posts = get_posts(array(
    'post__in' => $products,
    'post_type' => 'myproduct',
    'taxonomy' => $category->taxonomy,
    'term' => $category->slug,
    'nopaging' => true,
    ));