Advanced WP_Query
-
I’ve gone through the Codex and Google trying to make this query work, but it doesn’t want to budge no matter how many examples I follow.
I’m trying to do a query on a custom field that allows me to select all data with post_type of “homes” that has a “square_footage” >= [number] AND <= [number]
Here is what my current query looks like
$args = array( 'post_type' => "homes", 'post_status' => 'publish', 'posts_per_page' => -1, 'meta_query' => array( 'key' => 'square_feet', 'value' => array( $nums[0], $nums[1] ), 'compare' => 'BETWEEN' ); );When I do a print_r on the $args varialbe, I get the following:
Array ( [post_type] => homes [post_status] => publish [posts_per_page] => -1 [meta_query] => Array ( [relation] => AND [0] => Array ( [key] => square_feet [value] => Array ( [0] => 1000 [1] => 1250 ) [compare] => BETWEEN ) ) )I would greatly appreciate any help 🙂 Thanks!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Advanced WP_Query’ is closed to new replies.