Hide Pages from Search Results in WordPress
In WordPress by default both posts and pages are included in the Search Results, you can remove pages or posts for that matter and also include custom post types by using the action hook pre_get_posts.
In your functions.php add the appropriate snippet;
To remove pages from the search results add in…
To remove posts from the search results add in…
To add in custom post types to the search results add in
In the last code snippet we are passing in an array of different post types, just adjust the names of them to suit your needs.