_id) ";     }     return $join; }  function websmart_search_groupby( $groupby ) {     global $wpdb;     if( is_search() && !is_admin()) {             $groupby = "$wpdb->posts.ID";     }     return $groupby; }  function websmart_search_where( $where ) {     global $wpdb, $wp_query;     if( is_search() && !is_admin()) {             $where = "";             $search_terms = se_get_search_terms();             $n = !empty($wp_query->query_vars['exact']) ? '' : '%';             $searchand = '';             if (count($search_terms) < 0) {                     // no search term provided: so return no results                     $search = "0=0";             } else {                     foreach( $search_terms as $term ) {                             //$term = esc_sql( like_escape( $term ) );                             $term = $wpdb->esc_like( $term );                              // Get term by name in Custom taxonomy.                             $term_details = get_term_by('name', $term, 'pattern_type');                             $search .= "{$searchand}(($wpdb->posts.post_title LIKE '{$n}{$term}{$n}') OR ($wpdb->posts.post_content LIKE '{$n}{$term}{$n}') OR (m.meta_value LIKE '{$n}{$term_details->term_id}{$n}'))";                             $searchand = ' AND ';                     }             }             $where .= " AND 