php query, work only one at time

I using this php filter for search box in my wp website.
I know this is wrong because the filter show me only the last query, how I can write the code in the way both query work?

function SearchFilter($query) {
    if ($query->is_search) {
           $query->set('post_type', 'post');
           $query->set('post_type', 'course');
       }
    return $query;
}
add_filter('pre_get_posts','SearchFilter'); 

Thank you.

Read more here: php query, work only one at time

Leave a Reply

Your email address will not be published. Required fields are marked *