Exclude pages not working
Hello all,
at
www.dealpoint.nl I tried to add the following code to functions.php:
function remove_pages_from_search($query) {
if ($query->is_search) {
$query->set('post_type', 'post');
}
return $query;
}
add_filter('pre_get_posts','remove_pages_from_sear ch');
Alsosome other codes I tried to excluse pages from search results did not do the job.
Would anyone have a code that works?