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.

I created a custom post type envent. I d like to filter out post in the futere. I did use the advanced custom fields plugin to make a date picker. I used following code, but somehow id does not filter out the future post.

<?php $events = new WP_Query(
    'post_not_in'    => array($donotrepeat),
    'post_type'       => 'chuchi_event',
    'meta_key'        => 'event_datum',
    'orderby'        => 'meta_value',
    'order'           => 'dsc',
    'meta_query'  => array(         
              'key'     => 'event_datum',  
              'value'   => date("Ymd"),  
              'compare' => '<=',          
              'type'    => 'DATE'         
    )); ?>

    <?php while($events->have_posts()) : $events->the_post(); ?>

            <?php $date = date_create(''.get_field('event_datum').''); ?>
            <p><?php echo date_format($date,'l d.m.Y'); ?></p>                
            <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute();                 
            ?>" >   

        <?php endif; ?>     
share|improve this question
What is the format of the date in the database? –  s_ha_dum Dec 16 '13 at 16:26

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.