Issue with WordPress category search

You can search post by modify the query using pre_get_post filter. add this code inside your functions.php file

add_filter('pre_get_posts', 'search_by_category');
function search_by_category($wp_query)
{
    if (isset($_GET['cat']) && !is_admin()) {
        $wp_query->set('category__in', array($_GET['cat']));
    }
}

Before using any query variable you must have to register/add using add_query_var.

function add_category_query_string() {

    global $wp;
    $wp->add_query_var('cat');

}

add_filter('init', 'add_category_query_string');

let me know if it works for you .