How to Exclude Pages from WordPress Search Results without plugin

0
Wordpress logo

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

      1. First, open your current theme’s functions.php file.
      2. 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.

Vithalreddy.M.B is the Editor of VMRworld.com & stackFame.com with a focus on startups, Startup News, Business, and Technology.He is also an Electrical & Electronics Engineer, Technology Lover and Entrepreneur by choice.Started His first startup at 21.