generate functionThu, 17 Nov 2022

get all products that have at least one taxonomy product_tag

$args = array( 'post_type' => 'product', 'posts_per_page' => -1, 'tax_query' => array( array( 'taxonomy' => 'product_tag', 'field' => 'term_id', 'terms' => '20', ), ), ); $products = get_posts( $args );

Questions about programming?Chat with your personal AI assistant