Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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(  
        array(  
        'key' => '_rrhh_expire',  
        'value' => time(),  
        'compare' => '>=',  
        'type' => 'DATE'  
        )  
    )  
);  
query_posts($q);
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
add comment

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.