WordPress.org

Support

Support » How-To and Troubleshooting » Query custom post type & custom taxonomy not working!

Query custom post type & custom taxonomy not working!

  • I have a custom post type ‘promotion’ which is linked to a custom taxonomy type of ‘promotions-cat’. I’ve added ‘cat1’ as a category in this taxonomy.

    I’m trying to query this post type and query the category, which is not returning any results:

    $query = 'post_type=promotion&';
    $query .= 'posts_per_page=-1&';
    $query .= 'post_status=publish&';
    $query .= 'category_name=cat1&';
    $query .= 'orderby=date&';
    $query .= 'order=DESC';
    
    $news_list = new WP_Query();
    $news_list->query($query);

    Tried this too but not working 🙁
    $query .= 'cat=$post-cat_ID&';

  • The topic ‘Query custom post type & custom taxonomy not working!’ is closed to new replies.