Search suggestions doesn't get filtered


#1

Hello everyone,

I filtered the search results on my website by using the hook ‘pre_get_posts’ and following code in my functions.php.

add_action('pre_get_posts', 'post_search_filter');

function post_search_filter($query) {
	if (! is_admin() && $query->is_search)  {
		$query->set('post__not_in', array(5104, 5254, 3938));
	}
	return $query;
}

On the page of the search results the filter works fine. But the search suggestions from the search box in the header doesn’t get filtered at all.

Thanks you in advance!