WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using the ClassiPress theme as a base for a new theme. If you have worked with classipress, you should know that classipress handles its own category using the taxonomy ad_cat.
That said, I have a category named 7star and the following query to get the posts inside that category:

$the_query = new WP_Query( array('post_type'=>'ad_listing','category_name'=> '7star') );

Unfortunately this query does not work. It only fetches the posts withing categories that are of type category not ad_cat.
Anybody got any idea how to solve this?
I'm trying to avoid using manual sql query.

share|improve this question
up vote 1 down vote accepted

Well, I should have used the tax_query parameter. Something like the following:

$the_query = new WP_Query( array('post_type'=>'ad_listing',
'tax_query' => array(
        'taxonomy' => 'ad_cat',
        'field' => 'slug',
        'terms' => '7star'
) );
share|improve this answer

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.