I have a wordpress template I am trying to configure the search function
The user can enter 2 values, one for address and one for feature. Individually they work fine. but when both variables have a value. The search breaks and it cant find the information?? any help would be really appreciated…
function searching_filter_where($where) {
global $wpdb;
$sn = trim($_REQUEST['sn']);
$s = trim($_REQUEST['s']);
if($sn!=NEAR_TEXT){
$where = " AND (($wpdb->postmeta.meta_key like 'proprty_feature' and $wpdb->postmeta.meta_value like \"%$s%\") OR ($wpdb->postmeta.meta_key like 'address' and $wpdb->postmeta.meta_value like \"%$s%\")) AND $wpdb->posts.post_type in ('post','event') AND ($wpdb->posts.post_status = 'publish') AND (($wpdb->postmeta.meta_key like 'proprty_feature' and $wpdb->postmeta.meta_value like \"%$sn%\") OR ($wpdb->postmeta.meta_key like 'address' and $wpdb->postmeta.meta_value like \"%$sn%\")) ";
}
return $where;