WP_Query by a category id and a custom post_type

try this, it’s work for me.

    $args=array(
    'posts_per_page' => 50, 
    'post_type' => 'my_custom_type'
    'cat' => $cat_id,
);
$wp_query = new WP_Query( $args );

Category Parameters

cat (int): use category id.
category_name (string): use category slug (NOT name).
category__and (array): use category id.
category__in (array): use category id.
category__not_in (array): use category id.

Leave a Comment