Forums

I can not get WP_Query to pull a single, specific post (2 posts)

  1. Zac
    Member
    Posted 2 years ago #

    Hi there,

    I am trying to pull excerpts and custom fields from specific posts, I have tried using post titles and post id but I am only succeeding in pulling every single post information. For example I have this code trying to pull just the title for post with id 182

    <?php $map = new WP_Query();$map->query('post_id=182'); ?><?php while ($map->have_posts()) : $map->the_post(); ?><?php the_title(); ?><?php endwhile; ?>

    It pulls that title first but then pulls the title of every other post as well. Can someone please explain where I went wrong?

  2. MichaelH
    Volunteer
    Posted 2 years ago #

    Try p=182

Topic Closed

This topic has been closed to new replies.

About this Topic