Filter for where with join with wpostmeta in query ?
-
Hi everyone,
I try to do a custom search form and I have a problem to do a between width custom fields for this Real Estate website. I try to put a filter where in functions.php like this :
function filter_where($where = '') { if(!empty($_REQUEST['prix_mini'])) $where .= " AND wposts.ID = wpostmeta.post_id AND wpostmeta.meta_key = 'mprix' AND wpostmeta.meta_value >= '".$_REQUEST['prix_mini']."'"; if(!empty($_REQUEST['key'])) $where .= " AND (post_title LIKE '%".$_REQUEST['key']."%' OR post_content LIKE '%".$_REQUEST['key']."%')"; return $where; } add_filter('posts_where', 'filter_where');
But I have no results
Any ideas ?
Thanks for your help.
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘Filter for where with join with wpostmeta in query ?’ is closed to new replies.