title: Error in searching specific post_type form post_type column using WooCommerce product search
body: <p>I am using <a href="http://adambalee.com/search-wordpress-by-custom-fields-without-a-plugin/" rel="nofollow noreferrer">this code</a> to search products from a <a href="https://wordpress.org/" rel="nofollow noreferrer">Wordpress</a>/<a href="https://www.woothemes.com/woocommerce/" rel="nofollow noreferrer">WooCommerce</a> website.<br>
  My requirment is URL will be like "<a href="http://localhost/wp/?s=D34&amp;post_type=product" rel="nofollow noreferrer">http://localhost/wp/?s=D34&amp;post_type=product</a>"
  While <code>s=D34</code> is search string. </p>
  
  <p>When user will search for a string. Data will be searched from All default fields+ product's <code>custom filed</code>. The below code work fine with <a href="http://localhost/wp/?s=D34" rel="nofollow noreferrer">http://localhost/wp/?s=D34</a> but when <code>&amp;post_type=product</code> is concatenated with url then it say <a href="https://i.stack.imgur.com/2AbCv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2AbCv.png" alt="enter image description here"></a></p>
  
  <p><strong>Code is given below</strong></p>
  
  <pre><code>function cf_search_where( $where ) {
  global $pagenow, $wpdb;
  
  
      if ( is_search() ) {
  $where = preg_replace("/\(\s*".$wpdb-&gt;posts.".post_title\s+LIKE\s*(\'[^\']+\')\s*\)/",
              "(".$wpdb-&gt;posts.".post_title LIKE $1) OR (".$wpdb-&gt;postmeta.".meta_value LIKE $1)", $where );
          $where .= " AND ($wpdb-&gt;posts.post_type = 'product') ";
      }
  
      return $where;
  }
  add_filter( 'posts_where', 'cf_search_where' );
  </code></pre>
  
  <p><strong>This is to prevent distinct values</strong></p>
  
  <pre><code>  function cf_search_distinct( $where ) {
          global $wpdb;
  if ( is_search() ) {
      return "DISTINCT"; //to prevent duplicates
  }
  
  return $where;
  
  }
  add_filter( 'posts_distinct', 'cf_search_distinct' );
  </code></pre>
  
  <p>So What modification is required?</p>
  
  <p><code>URL</code> <a href="http://localhost/wp/?orderby=price&amp;post_type=product" rel="nofollow noreferrer">http://localhost/wp/?orderby=price&amp;post_type=product</a> work fine </p>
  
  <p>but what is wrong with <a href="http://localhost/wp/?s=D34&amp;post_type=product" rel="nofollow noreferrer">http://localhost/wp/?s=D34&amp;post_type=product</a></p>