Selecting a meta_value that is less or more than
-
Hi, If the answer is out there, I couldn’t find it because I don’t know the correct terminology to search for it.
I’ve got posts with special deals that expire on various dates, mixed in with normal posts. On the category pages, I want to create a list of special deal posts in that category that haven’t expired.
I’ve put a custom field called ‘expires’ in special deal posts and I put the date when the deal is over as the value. My query looks like this:
get_posts(array('category' => $categories[0]->term_id, 'meta_key' => 'expires', meta_value => ... ))
So the question is, what is the syntax to use to get posts where ‘expires’ is equal to now() or later? Or for that matter, how do I select a custom field based on whether it’s more or less than a particular number?
Any assistance is greatly appreciated.
- The topic ‘Selecting a meta_value that is less or more than’ is closed to new replies.