Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've created a custom post type and custom taxonomy. I can now create a new post and associate it with a custom category.

The problem is listing these news post types.


$loop = new WP_Query( array( 'post_type' => 'sobeedesce' ) );
while ( $loop->have_posts() ) : $loop->the_post();
  echo "<br />";

lists all custom posts ok. But I want to list them by category, so adding 'cat' => 12 returns nothing.

I know my custom category id is 12 and I can confirm that by doing

$custom_terms = get_the_terms(0, 'cat_sd');

inside the loop.

I'm missing something here. Can someone help me? Thanks.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

I suppose your custom taxonomy slug is 'cat_sd', right?

If so, the right query would be:

$loop = new WP_Query( array( 'post_type' => 'sobeedesce', 'cat_sd' => 12 ) );
share|improve this answer
That put me in the right track, thanks. Just had to change 'cat_sd' => 12 to 'cat_sd' => 'slug_of_this_cat' – fana Oct 5 '10 at 21:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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