Exclude WordPress pages from Search results

Here’s a cool snippet to remove the WordPress Pages from search results.

Pretty straight forward, paste the following code inside your functions.php file:

You can also filter the WordPress Search by custom post type, if you need to 😉

2 Responses to “Exclude WordPress pages from Search results”

  1. Erik March 18, 2014 at 9:58 am #

    Hi.. Great code.. but do you know a way of only Exclude or Include page that have a type of metadata value. Thanks!

Leave a Reply

Add <code> Some Code </code> by using this tags.