The query as written will retrieve posts with the post type custom_type_houses
that are For Rent OR in Arusha. If you want just houses that are both For Rent AND in Arusha you will need to change 'relation' => 'OR'
in your meta query to 'relation' => 'AND'
, like so:
<?php
$args = array(
'post_type' => 'custom_type_houses',
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'custom_meta_location',
'value' => 'Arusha',
'compare' => '=',
),
array(
'key' => 'custom_meta_status',
'value' => 'For Rent',
'compare' => '=',
),
),
);
$query = new WP_Query( $args );
while ( $query->have_posts() ) {
$query->the_post();
}
?>