I’m glad you figured out I meant $query->request. Sorry about that.
Yes, the request appears to be in order. I don’t know why the Codex suggested meta_type
, it is not part of the resulting request and I don’t see where it is considered in source code. No matter, ordering the date format you are using as meta_value_num should be just fine. (FYI, adding +0
to an order by field is an old SQL trick to force numeric evaluation).
It’s still possible for a plugin or theme conflict to be causing problems even if the request is correct. Something is altering the request, though the result should still work for you. It is missing the usual default alternate post statuses like pending, draft, etc. The secondary date orderby argument is also missing.
Try adding this in place of the echo request line:
print_r($query->posts);
You should get a long listing of post object data for posts found by the request. If you get an empty array, no posts were found. Assuming posts were found here but no output appears on your page, some plugin or your theme is messing with your looping of the results. Try selectively deactivating suspect components until the problem goes away.
If you get an empty array, there’s something wrong with your query assumptions and there really are no matching posts. Review each =
clause in the request and confirm it’s correct. Skip the first one after ON
, I know that one is correct. Be sure the meta key on the post edit screens is really “expiry” and not “Expiry” or anything else that is not an exact match.