Home Forums General Issues Exclude posts with expired date (Datepicker)


Exclude posts with expired date (Datepicker)

  • I’m using ACF Datepicker to show posts on my website for ordering.

    I want posts that have given a specific date that is expired to hide from the output. So if the date is 12 Agust 2013 is may not be in the output.

    This is the code i have from ACF.

    $posts = get_posts(array(
    'meta_key'			=>	'MY_META_KEY',
    'orderby'			=>	'meta_value_num',
    'order'				=>	'ASC',
    'posts_per_page'	=>	4,
    if($posts) { foreach($posts as $post) { ?>
    // Post output
    <?php } wp_reset_postdata(); } ?>

    Somebody any idea?

  • Hi @tigerfish

    Looks like you need to add in a meta_query arg to the query.

    To get you started, please read the guide for filtering posts:

    After you have read and understand the above, please have a search around for “query posts after date custom field” – you should find plenty of threads on google!


Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Exclude posts with expired date (Datepicker)’ is closed to new replies.