Support

Account

Home Forums General Issues Multiple custom post types by custom taxonomy on same page Reply To: Multiple custom post types by custom taxonomy on same page

  • I’m pretty sure that a taxonomy field stores an array terms IDs, or if you have it set to return term objects then it returns an array of term objects. See the image below. If you want to use the returned value in queries like this those should be the settings of your taxonomy field. Then change your query slightly.

    
    <?php
        $taxterms = get_field("collectiona");
        $args = array(
            'post_type' => 'products',
            'tax_query' => array(
                array(
                    'taxonomy' => 'product-collections',
                    'field' => 'id',
                    'terms' => $taxterm, // remove ->term_id
                )
            )
        );