For multiple category handling you need either category__in
or a tax_query
, for multiple custom fields you use meta_query
. The various options for both of these are covered in the WP_Query
codex page.
$args = array(
'posts_per_page' => 10,
'category__in' => array( 163, 165 ),
'meta_query' => array(
array(
'key' => 'a_field',
'value' => array( 1, 2 ),
'compare' => 'IN'
),
array(
'key' => 'a_fieldd',
'value' => 3,
'compare' => '='
),
array(
'key' => 'a_fielddd',
'value' => array( 1, 3, 5 ),
'compare' => 'IN'
)
)
);
$results = new WP_Query( $args );
if( $results->have_posts() ){
while( $results->have_posts() ){
$results->the_post();
the_title();
}
}