Exclude Posts or Pages from Search Results

This snippet will allow you to control which posts or pages there should be excluded from WordPress search results.

Add this code to your functions.php file.
* In this snippet, posts with the IDs 0 and 1 will be excluded – edit accordingly to suit your needs.