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

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