title: how do we combine the categories with tags in wordpress
body: <p>Here query is used to retrieve only 3 post related to the category. </p>
  
  <pre><code>$related = get_posts( array(
        'category__in' =&gt; wp_get_post_categories($post-&gt;ID),
        'numberposts' =&gt; 3,
        'post__not_in' =&gt; array($post-&gt;ID)
      ) );
  </code></pre>
  
  <p>But if the post is less than three at that time am in need of the  post based on tag.</p>
  
  <p>Need to display 3 post by category if not have to display it by tags.</p>
  
  <p>Don't know how to set the condition for that, please suggest some ideas for that.</p>