Skip to content

Instantly share code, notes, and snippets.

@g-maclean
Created November 15, 2024 11:30
Show Gist options
  • Select an option

  • Save g-maclean/497f9e18f345414e0aaf7eabe4864e0a to your computer and use it in GitHub Desktop.

Select an option

Save g-maclean/497f9e18f345414e0aaf7eabe4864e0a to your computer and use it in GitHub Desktop.
PropertyHive - match address 2 & 3 in similar properties shortcode
add_filter('propertyhive_shortcode_similar_properties_query','match_addresses_2_and_3', 2, 10);
function match_addresses_2_and_3($args, $atts){
$original_match_query = $args['meta_query'][3];
if($original_match_query['key']!='_address_three'){return $args;}
$new_match_query[] = $original_match_query;
$new_match_query[] = array("key" => "_address_two", "value" => $original_match_query["value"]);
$args['meta_query'][3] = array('relation' => 'OR', $new_match_query);
return $args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment