1

I have registered custom post type Article in my template using register_post_type function. and i also having taxonomy category for this article posts.

Here i want to filter the posts under particular category. using query post

How can i do this

Thanks in advance !

3

If you read http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters in detail it outlines everything you need. Take a look at the following code sample taken from the codex. It should help you :)

$args = array(
    'post_type' => 'Article', /* This is where you should put your Post Type */
    'tax_query' => array(
        array(
            'taxonomy' => 'people',
            'field' => 'slug',
            'terms' => 'bob'
        )
    )
);
$query = new WP_Query( $args );

Please note that this query does NOT account for paginated data.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.