A situation that comes up often is wanting to hide certain pages from WordPress search results. This can be achieved pretty easily using the pre_get_posts hook in your functions.php file. Just pass in an array of page IDs to the 'post__not_in' WP_Query parameter (note the double underscores) and you’re good to go.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters