Filter

Remove a Post Type from the Search Results

add_action( 'pre_get_posts', 'remove_post_type_from_front_end_search_results');

function remove_post_type_from_front_end_search_results($query){

	if(is_admin() || !$query->is_main_query()) return;

		if($query->is_search()){

			$post_type_to_remove = 'your_post_type';
			$searchable_post_types = get_post_types(array('exclude_from_search' => false));

			if( is_array($searchable_post_types) && in_array($post_type_to_remove, $searchable_post_types) ){
				unset( $searchable_post_types[ $post_type_to_remove ] );
				$query->set('your_post_type', $searchable_post_types);
			}
		}
	}
}