Custom Post Type WP_Query with filters and search

This is what I ended up with:

$specialty_terms = get_terms('specialty');
$specialty_term_ids = wp_list_pluck($specialty_terms, 'slug');

$location_terms = get_terms('locations');
$location_term_ids = wp_list_pluck($location_terms, 'slug');

if( isset($_GET['docname']) ):
    $name_search = $_GET['docname'];
else:
    $name_search = "";
endif;

if( isset($_GET['specialty']) && $_GET['specialty'] !== ''):
    $specialty = $_GET['specialty'];
else:
    $specialty = $specialty_term_ids;
endif;

if( isset($_GET['location']) && $_GET['location'] !== ''):
    $location = $_GET['location'];
else:
    $location = $location_term_ids;
endif;


    $args = array(
    'post_type'      => 'doctor',
    'orderby'        => 'menu_order',
    'order'          => 'ASC',
    'paged'          => get_query_var('paged'),
    'posts_per_page' => '8',
    'post_title_like' => $name_search,
    'tax_query' => array(
            'relation' => 'AND',
            array(
                    'taxonomy' => 'specialty',
                    'field' => 'slug',
                    'terms' => $specialty
            ),
            array(
                    'taxonomy' => 'locations',
                    'field' => 'slug',
                    'terms' => $location
            ))
        );
global $post;
$loop = new WP_Query( $args );

There might be an easier way of doing this, but I created a text field where they can type a name and I also included two other select fields to select the Location and/or Specialty. I then pull the data in from the URL to modify the query.