Well, for whoever went under the same question, I found the solution:
I’ve changed the filter and looks like this now:
add_filter( 'posts_where', 'general_filter', 10, 2 );
$posts = new WP_Query($args);
remove_filter( 'posts_where', 'general_filter', 10, 2 );
and the function…
function general_filter( $where, &$wp_query )
{
global $wpdb;
if ( $search_term = $wp_query->get( 'search_prod_title' ) ) {
$where .= ' AND (' . $wpdb->posts . '.post_title LIKE \'%' . esc_sql( like_escape( $search_term ) ) . '%\' OR ' . $wpdb->posts . ' .post_excerpt LIKE \'%' . esc_sql( like_escape( $search_term ) ) . '%\' OR ' . $wpdb->posts . ' .post_content LIKE \'%' . esc_sql( like_escape( $search_term ) ) . '%\')';
}
return $where;
}
The error basically was that the entire query was wrong, so while debugging the variable $where
I found the error and fix it. Hope this could help someone.