If you ever want to exclude your WordPress blog pages from search results, Then this guide is for you.By default WordPress pages are included in search results as soon as post or page get published.So today we will tell you, How to exclude wp pages from search results without the plugin, and if you want to do the plugin way, we will also list the plugins for you at the end of this article.
Steps to Exclude Pages from WordPress Search Results without plugin
- First, open your current theme’s functions.php file.
- Now paste or add the following PHP code.
What this code does is that it just searches for post_type only, and if you want, you can reverse the process and set it to search only pages also.
Plugins to Exclude Pages from WordPress Search Results
And, Now if you to do it with the plugins, you can do it with Simply Exclude and by using this plugin you can also exclude single or multiple pages.