You may have to use OR, instead of AND. Try following, instead. $where .= " AND ( meta_key = '$key' AND meta_value LIKE('%$val%') ) OR meta_value = 'foo' ";