title: Wordpress Custom Taxonomy Search
body: <p>I'm trying to implement search, which will look through custom taxonomy terms. 
  I have custom type called "product", and custom taxonomy called "type". When I'm using wordpress standard form it works good except the fact, that it doesn't search in custom taxonomy terms.</p>
  
  <p>So, what I need is:
  1. Make WP search through "m_type" taxonomy terms
  2. It should use "name" of the term, instead of "slug".</p>
  
  <p>I was trying to include additional query vars to make it look through "slugs" at least. </p>
  
  <p>This code:</p>
  
  <pre><code>$wp_query-&gt;query['tax_query'] =  array(
          array(
              'taxonomy' =&gt; 'm_type',
              'field' =&gt; 'slug',
              'terms' =&gt; 'pen'
          )
      );
  </code></pre>
  
  <p>Generates the following SQL:</p>
  
  <pre><code>SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts INNER JOIN wp_term_relationships 
  ON (wp_posts.ID = wp_term_relationships.object_id) INNER JOIN wp_postmeta ON 
  (wp_posts.ID = wp_postmeta.post_id) WHERE 1=1 AND ( wp_term_relationships.term_taxonomy_id 
  IN (163) ) AND (((wp_posts.post_title LIKE '%pen%') OR (wp_posts.post_content LIKE 
  '%pen%'))) AND wp_posts.post_type IN ('product') AND (wp_posts.post_status 
  = 'publish' OR wp_posts.post_author = 1 AND wp_posts.post_status = 'private') AND
   (wp_postmeta.meta_key = 'max_price' ) GROUP BY wp_posts.ID 
  ORDER BY wp_postmeta.meta_value+0 DESC LIMIT 0, 60
  </code></pre>
  
  <p>So, basically it adds custom taxonomy, search through posts, that have this kind of taxonomy (*wp_term_relationships.term_taxonomy_id IN (163)*) but actually never compares taxonomy term with query string.</p>
  
  <p>Maybe I'm doing all of this wrong? </p>