title: wordpress search query : include tags AND limit these tags to specific category
body: <p>I would like to add a <strong>filter function</strong> in my wordpress search query :</p>
  
  <blockquote>
    <p>Limit the query posts in category 7,8
    AND  include tags in the search which are in category 7,8</p>
  </blockquote>
  
  <p>I have already the code to limit to category 7,8 but I don't know how to include tags in the query search and limit these tags to category 7,8</p>
  
  <pre><code>function SearchFilter($query)
   { if ($query-&gt;is_search) 
  {$query-&gt;set('cat','7,8');
   $query-&gt;set('post_type', 'post');
   }
  return $query;
   }
  add_filter('pre_get_posts','SearchFilter');
  </code></pre>
  
  <p>thank you for help :)</p>