ACF PRO: Get Next Event Post From Today's Date

I’m using this ACF Pro/Wp Query parameters to compare and post the next upcoming event from today’s date. I only want the next event to display. Somewhere my code is wrong.

                get_field('tradeshows', 40);
                $today = date('Ymd');
                $event_date = get_sub_field('event_date');
                $next_event_query = new WP_Query(array (
                              'post_type'      => 'post',
                              'post_status'    => 'publish',
                              'posts_per_page' => -1,
                              'meta_query'     => array (
                                array (
                                  'key'        => 'event_date',
                                  'compare'    => '>',
                                  'value'      => $today,
                              'orderby'        => 'meta_value',
                              'order'          => 'ASC'
                <div class="trades">
                    <?php if ($next_event_query->have_posts()) : while ($next_event_query->have_posts()): $next_event_query->the_post(); ?>
                        <div class="col-md-3">
                             <h3>NEXT TRADESHOW</h3>
                            <p class="eventdate"><?php echo $event_date ; ?><br />
                            <span class="locplace"><?php the_sub_field('event_location'); ?></span></p>
                 <?php wp_reset_postdata(); ?>
                   <?php endwhile; ?>

I created a repeater custom field (tradeshows) and assigned it to a page (PostID 40). Inside that page is a series of events with dates created from the custom fields.

What I’m trying to accomplish:
Compare the subfield ‘event_date’ with today’s date. If the subfield ‘event_date’ is greater than today’s date then post that next single event.

Anyone understand why my query isn’t working?

Repeater Field Settings:

PageID 40:

Just taking a guess, but does event_date have the same format as $today? ( $today = date('Ymd'); )

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.