Fixed search value, changed back to get_search_query, removed unnecessary check
Changed esc_url to esc_url_raw in redirect