The answer to this question is here.
The full credit of the answer to my question goes for the author of the answer birgire.
All I had to do was slightly change is plugin "Support for post name like in WP_Query" turning it into a function like this:
add_filter( 'posts_where', 'title_like_posts_where', 10, 2 );
function title_like_posts_where( $where, $q) {
if( $name__like = $q->get( '_name__like' ) )
{
global $wpdb;
$where .= $wpdb->prepare(
" AND {$wpdb->posts}.post_name LIKE %s ",
str_replace(
array( '**', '*' ),
array( '*', '%' ),
mb_strtolower( $wpdb->esc_like( $name__like ) )
)
);
}
return $where;
}
A special thanks to Pieter Goosen for pointing my out to the solution.
WHERE post_content LIKE '%$query%'
withWHERE post_title LIKE '%$query%'