Reputation: 184
I am trying to query posts by comparing meta value. I have set two meta with the posts. i.e. 'start_date' and 'end_date'. they are stored as UNIX timestamp.
Now I want to query posts on following conditions:
In this case, I want both conditions to fulfill. So, I have used 'relation'=>'AND'.
So here is the print_r of the query:
Array
(
[post_type] => ads
[meta_query] => Array
(
[relation] => AND
[0] => Array
(
[kye] => start_date
[compare] => <=
[value] => 1352054503
[type] => NUMERIC
)
[1] => Array
(
[kye] => end_date
[compare] => >=
[value] => 1352054503
[type] => NUMERIC
)
)
)
Note: ads is a custom post type.
And here is meta of a post:
Array
(
[start_date] => Array
(
[0] => 1352160000
)
[end_date] => Array
(
[0] => 1352246400
)
)
I see absolutely no reason why this post should show up. The start date timestamp(1352160000) is bigger than the current timestamp(1352054503). Which breaks condition #1. So, why is this still showing up? What do you think?
Upvotes: 0
Views: 1024