Support » Fixing WordPress » get custome categories in WP_Quesry

  • Hi all,

    i have this query in my template $the_query = new WP_Query( array( "posts_per_page" =>6, "post_type"=>"project_post" , "paged"=>$offset , "order" => $order , "orderby" => $order_by ) );

    it fetches all the custom categories for project post, however i want it to fetch only one custom category called ‘Ongoing’ it has a taxonomy=project_category and tag_ID=11

    Thank you

Viewing 1 replies (of 1 total)
  • Please try this:

    $the_query = new WP_Query( array(
                      "posts_per_page" =>6,
                      "post_type"=>"project_post" ,
                      "paged"=>$offset ,
                      "order" => $order ,
                      "orderby" => $order_by,
                      'tax_query' => array(
                         array(
                            'taxonomy' => 'project_category',
                            'field' => 'id',
                            'terms' => array(11),
                         )),
    
                      ) );
Viewing 1 replies (of 1 total)
  • The topic ‘get custome categories in WP_Quesry’ is closed to new replies.