Support » Fixing WordPress » Get one post with tag and in category?

  • Xavvi

    (@skinny-latte)


    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

  • The topic ‘Get one post with tag and in category?’ is closed to new replies.