• We are available for any Development work:
  • Email us at: programmer_heart@yahoo.com

Get all post of certain category of particular post type in wordpress

You can use following code to display all post related to certain category of any custom post type.


global $post;

‘post_type’ => $post_type,
‘post_status’ => ‘publish’,
‘tax_query’ => array(
‘taxonomy’  => $post_type.’_category’,
‘field’     => ‘term_id’,
‘terms’     => $cateid
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query($params_mostwatched);
while ($wp_query->have_posts()) : $wp_query->the_post();

echo $post->post_title;



Leave a Reply

Your email address will not be published. Required fields are marked *

Press Enter to Search