Quantcast
Channel: User janh - WordPress Development Stack Exchange
Viewing all articles
Browse latest Browse all 40

Answer by janh for Why is my WP Query not returning first result's post meta?

$
0
0
    $show_date = get_field('show_date');    $show_venue = get_field('show_venue');    // print '<pre>';    // print_r($show_date);    // print '</pre>';    $query->the_post();

You are setting the active post AFTER getting the values.

Put $query->the_post() always at the top of that while loop, so that the other functions can rely on the global $post variable being set correctly.


Viewing all articles
Browse latest Browse all 40

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>