I want to extract post related to 3 meta_data fields called bed_value, bath_value, rob_value the variable data is $bedrooms, $bathrooms, &rob, I got some confused with join and like structure. The unworking metaquery is this
$args = array(
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'beds_value',
'value' => $bedrooms,
'compare' => '='
),
array(
'key' => 'baths_value',
'value' => $bathrooms,
'compare' => '='
),
array(
'key' => 'rob_value',
'value' => $rob,
'compare' => '='
),
),
);
$args = array_merge( $args , $wp_query->query );
query_posts( $args );
So it is better and easier to do a SQL wpdb query I will change the code. prior wpdb query with $wpdb->get_results($query, OBJECT);
does not allow to paginate the results, thats why I tried to change to meta_query I need more knowledge!