Updated this answer in response to first comment below:
if(!empty($_GET['city']) AND !empty($_GET['state']))
{ // if both fields are filled out, find houses that match both
$relation = "AND";
}
elseif(empty($_GET['city']) OR empty($_GET['state']))
{ // if either of the fields are empty, find houses that match either field
$relation = "OR";
}
$args = array(
'post_type' => 'house',
'post_title' => $housename,
'meta_query' => array(
'relation' => $relation,// use $relation variable instead of string here
array(
'key' => 'house_city',
'value' => $city
),
array(
'key' => 'house_state',
'value' => $state
)
)
);
I’m not sure but I think having the $housename empty would look for houses with an empty post title. You may need to conditionally add that part to your query, something like this could work:
if(!empty($_GET['housename']))
{
$houseNameQuery = "'post_title' => $_GET['housename']";
}
Then in your $args replace the ‘post_title’ parameter:
$args = array(
'post_type' => 'house',
$houseNameQuery,
'meta_query' => array(...