Exclude pages from search results in WordPress

The research shows the results, including WordPress pages. A quick way to solve this problem is to remove all pages from the search results. The function can be expanded with the addition of other types of post_type for the query. File to edit: functions.php