WordPress.org

Ready to get started?Download WordPress

Forums

Get one post with tag and in category? (1 post)

  1. Skinny_Latte
    Member
    Posted 3 years ago #

    Hi,

    I'm trying to get one post in the category 'activity' with the tag 'featured'

    <?php $my_query = new WP_Query('category_name=activity&tag=featured&showposts=1');
      while ($my_query->have_posts()) : $my_query->the_post();
      $do_not_duplicate = $post->ID;?>

    This code is showing me 2 posts from the same category with the same tag. Does anyone know why this isn't working? I only need one!

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Topic