category__and
is exclusive, so it will not work for your application, if you use tax_query
and setup your query as follows, it should work:
$args = array(
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'category',
'field' => 'id',
'terms' => $city,
//'include_children' is true by default
),
array(
'taxonomy' => 'category', //may need to be categories, I don't recall, tweak it till it works.
'field' => 'id',
'terms' => $category,
//'include_children', again, is true by default
)
)
);
$posts = query_posts( $args );
If that doesn’t sit well with query_posts()
(I don’t see any reason it wouldn’t), WP_Query
won’t complain, so just use that. Also, that link to WP_Query
has all the docs you’ll need to modify that query, so thumb through there, you’ll probably at least want 'post_status' => 'publish'
…maybe some more.