To exclude a page or post from the search result page you can simply use the pre_get_posts filter. But you can customize it more by adding a checkbox on pages/posts and then simply enabling the search result exclusion from the page/post itself.

Simply copy the code into the website child theme or code-snippet plugin. Once you enable it on any page or post it will be excluded from the results page.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.