I would like to exclude specific pages and posts from the search results, but don't know how to do it. I tried it with the 'Search Exclude' plugin, but that doesn't work out.
Any ideas?
Hey,
Please goto
wp-admin > wplms > course manager > hide course from directory,
Refer:
http://prntscr.com/mahsun
let me know if you need any further information.
It is more about the search results of the whole website. Any page and post shows up there. So how to excluded a page from the website search results?
Hi,
The plugin doens't work with this theme :-(
And the other way (functions.php) also doesn't work. I think that code is only for Wordpress posts and not for Wordpress pages?
We have tested the code and its working for us :
function wpb_search_filter($query) {
if ($query->is_search) {
$query->set('post__not_in', array(76,78));
}
return $query;
}
add_filter('pre_get_posts','wpb_search_filter',99999);
In above code put your page ids , comma separated : " array(76,78,2,108) "
Thanks, that worked for me also
Hey There,
Voila ! If I can be of assistance, please do not hesitate to contact me again.
Closing this topic.
Best regards :)