WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

First of all, sorry guys for my poor english. OK, i wanna make a query for show posts that doesn´t passed 3 days from it publication. I set a field for the expire date when it´s published (the time is in unix and i have added the 3 days in this field when it saves to the db), so i have the expire date set it. But my problem is make a query using the meta_query, i found in several posts how easy is to change the status of all posts but what i need is make this query work beside the status. This is my code

 $q = array (   
     'paged' => $paged,  
     'meta_key' => '_rrhh_expire',  
     'orderby' => 'meta_value',  
     'meta_query' => array(  
        'key' => '_rrhh_expire',  
        'value' => time(),  
        'compare' => '>=',  
        'type' => 'DATE'  
share|improve this question
change 'type' => 'DATE' to 'type' => 'numeric' to compare unix timestamp values. – Anjum Sep 6 '13 at 19:30
and also have you added time() + 259200 (3 days) in meta field? – Anjum Sep 6 '13 at 19:33
Yes the time() + 259200 i have added when the post is published. And it´s working now with 'numeric'! – Seba Ortiz Sep 6 '13 at 20:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.