Get Posts in a Custom Post Type category

As far as I know there is no such parameter as post_type_cat, you want to use either cat or if querying posts in a custom taxonomy you would use a taxonomy query.

Category query example;

$query = new WP_Query( 'cat=2,6,17,38' );

or

$query = new WP_Query( 'category_name=staff' );

See the following Codex entry for even more ways to query by category;

http://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters

Taxonomy query example;

$args = array(
    'post_type' => 'post',
    'tax_query' => array(
        array(
            'taxonomy' => 'people',
            'field' => 'slug', //can be set to ID
            'terms' => 'bob' //if field is ID you can reference by cat/term number
        )
    )
);
$query = new WP_Query( $args );

See this entry for more details:

http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters

Leave a Comment