If you want to hide pages from appearing when your readers use the default WordPress search box on your website, you have several options.
- Install the Simply Exclude plugin
- Install the Search Everything plugin
- Add different PHP code to your child themes functions.php file
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.
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.
ConclusionSubscribe for Genesis Tutorials - Double Opt In Confirmation Required