WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following query in WordPress to call custom post meta, everything is working fine, with one exception, whichever query is second is echoing nothing. Sorry for the WordPress post, but for those unfamiliar the 'get_post_meta($post->ID' is retrieving the post ID for the first one and then echoing the same for the second, I need to close the first query but don't know how.

            <h3 class="body_heading">
            <?php $soon_events = get_post_meta($post->ID, 'coming_soon_events', true); if ($soon_events) : echo $soon_events; endif; ?>

        <h3 class="body_heading clear">
            <?php $feat_events = get_post_meta($post->ID, 'featured_events', true); if ($feat_events) : echo $feat_events; endif; ?>
share|improve this question
up vote 3 down vote accepted

Try <?php wp_reset_query(); ?> after each function. See Function Reference/wp reset query « WordPress Codex

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.