How to query_post custom posts within default taxonomy?

I’m trying to query_post custom posts. It works very good with custom taxonomy, but not with default “category” taxonomy. I tried using “category_name” and “tax_query”, but it doesn’t work for me.

My code is:

Read More
  $c_args = array(
  'post_type' => 'product',
  'tax_query' => array(
       array(
           'taxonomy' => 'category',
           'field' => 'slug',
           'terms' => 'furniture'
        )
    )
);

// The Query
wp_reset_postdata();

query_posts( $c_args );

I get no results.
As I said – it works with custom taxonomy, but I need to use “Custom Permalinks” plugin, which doesn’t work with custom taxonomy.

Any help appreciated.

Related posts

Leave a Reply

1 comment

  1. Use WP_Query instead of query_posts().

    $cpt_args = array(
        'post_type' => 'product',
        'tax_query' => array(
            array(
                'taxonomy' => 'category',
                'field' => 'slug',
                'terms' => 'furniture'
            )
        )
    );
    $cpt_query = new WP_Query( $cpt_args );