posts key/value and search returns
-
I have a search form it returns as a GET so I need to build a multi args query
It returns these values
Used – Diesel – 0,100 – 0,150000The meta
[php] $args = array( 'meta_query' => array( // 'post_type' => 'post', // 'category' => 1165, 'relation' => 'AND', array( 'key' => 'condition', 'value' => $condition, 'compare' => '=' ), array( 'key' => 'fuel', 'value' => $fuel, 'compare' => '=' ), array( 'key' => 'loa_feet', 'value' => array($nloa), 'type' => 'numeric', 'compare' => 'BETWEEN', ), array( 'key' => 'price', 'value' => array($nprice), 'type' => 'numeric', 'compare' => 'BETWEEN', ), // 'key' => 'price', // 'orderby' => 'meta_value_num', // 'order' => 'DESC' ) ); print_r($args); $custom_posts = get_posts($args); ?><br /><?php print_r($custom_posts); [/php]
returns
Array ( [meta_query] => Array ( [relation] => AND [0] => Array ( [key] => condition [value] => Used [compare] => = ) [1] => Array ( [key] => fuel [value] => Diesel [compare] => = ) [2] => Array ( [key] => loa_feet [value] => Array ( [0] => 0,100 ) [type] => numeric [compare] => BETWEEN ) [3] => Array ( [key] => price [value] => Array ( [0] => 0,150000 ) [type] => numeric [compare] => BETWEEN ) ) )
but no results (there should be)
$custom_posts is an empty array ( Array() )
and I cannot fathom why.
Appreciate any insightThe page I need help with: [log in to see the link]
- The topic ‘posts key/value and search returns’ is closed to new replies.