You don’t provide the context of where the code in your question is being used. Is it something like the following:
$args = array (
's' => '201701057',
'meta_query' => array (
'relation' => 'OR',
array (
'key' => 'property_address',
...
),
array (
'key' => 'property_city',
...
),
...
),
) ;
$query = new WP_Query ($args) ;
If so, then you should be able to hook into get_meta_sql as follows:
add_filter ('get_meta_sql', 'wpse_get_meta_sql_OR', 10, 6) ;
function
wpse_get_meta_sql_OR ($sql, $queries, $type, $primary_table, $primary_id_column, $context)
{
$sql['where'] = preg_replace ('/^(\s*)AND/', "$1OR", $sql['where']) ;
return ($sql) ;
}
Caveat
As is, the wpse_get_meta_sql_OR()
func above is NOT intended to be used in general purpose code…because you MIGHT not want to OR
the meta_query
if there were other than the 's' => '...'
arg to WP_Query…but it certainly produces your desired SQL IF 's' => '...'
is the ONLY other arg to WP_Query than the `meta_query’.