get a list of posts from Custom Taxonomy

Check out the Taxonomy Parameters.

<?php
$args = array(
    'post_type' => 'product',
    'post_status' => 'publish',
    'posts_per_page' => -1,
    'tax_query' => array(
        array(
            'taxonomy' => 'taxonomy_name',
            'field' => 'id',
            'terms' => '22'
        )
    )
);
$the_query = new WP_Query( $args );
while ( $the_query->have_posts() ) : $the_query->the_post();
    //content
endwhile;
?>

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)