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;

Thank you.

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


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: