Exclude Pages or Posts From Search Results

If you want to hide pages from appearing when your readers use the default WordPress search box on your website, you have several options.

The Simply Exclude plugin will enable you to select which specific pages or posts you don’t want appearing in your sites search results.

The Search Everything plugin enables you to exclude posts and categories from displaying in the default WordPress search functions results.

Code Snippets

Here’s several code snippets you can use to exclude pages and posts from displaying in your search results on your site.

This code returns search results for posts only and excludes all pages from displaying on your sites search results when your readers use your search box.

This code removes all posts from displaying in your search results and only returns results for pages.

This code removes a post type, in this case pages, from search results when using the default WordPress search function.

Conclusion

You can also exclude posts assigned to one or more categories from displaying in your RSS feed.


Comments

2 responses to “Exclude Pages or Posts From Search Results”

  1. Deborah Davis Avatar
    Deborah Davis

    Hi – great plugin. I understand this hides the pages from searches on the website. But do know if it also hides them from web searches? Like when you’re trying to have a “hidden” page for resources that people purchase? Thanks!

    1. Hi Deborah. This won’t hide them from the search engines. To do that you’ll need to select the noindex option.

Leave a Reply

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.