Are you wondering how to exclude pages from site search results in WordPress?
By default, WordPress shows all the posts and pages on your website that match a search query. But, it might not be handy in some cases.
In this article, we’ll show you the easiest way to hide any post or page from WordPress search results in just a few clicks.
As this article contains a set of step-by-step guides for every content type, here is a table of contents to help you navigate:
- How to Exclude All Pages or Posts from WordPress Search Results
- How to Exclude Specific Pages, Posts, or Custom Post Types
Let’s get started!
Why Hide Pages from WordPress Search Results?
Hiding specific search results can be helpful in certain situations.
For example, almost all websites have a set of technical pages. This set usually includes a sitemap page, taxonomy and category pages, and many more.
Despite these pages being essential, you’d prefer to exclude them from search results in most cases.
The same goes for online stores. WordPress doesn’t see any difference between regular and technical pages such as login, checkout, thank you page, and others.
As you need them on your website, the best solution is to hide them from search results.
Another good example is membership websites. If you’re selling online courses or other digital products, you don’t want paid content to appear in the search results.
Even a regular website owner may need to hide a certain page from search results from time to time.
How to Exclude All Pages or Posts from WordPress Website Search Results
The easiest way to exclude all pages or posts from site search results in WordPress is to use a plugin like SearchWP.
As the best WordPress search plugin, SearchWP allows you to hide any posts, pages, or media files from the search results in a few clicks – no coding needed.
It also comes with tons of features that widely expand the WordPress search capabilities, such as:
- Enhanced search. The native WordPress search engine only considers post and page content while searching. By using SearchWP, you can make almost anything searchable on your website.
- WooCommerce integration. Most WordPress eCommerce plugins store the product attributes as custom fields and taxonomies. But WordPress completely ignores them by default! With SearchWP, this isn’t an issue anymore, as you can make custom fields and taxonomy terms searchable in a few clicks.
- Site search insights. SearchWP allows you to collect and see data about your visitors’ on-site search activity. You can figure out what your visitors want to find and provide them with it by analyzing this information.
Now, let’s see how to exclude all posts or pages from WordPress search results with the help of SearchWP.
Step 1: Install and Activate SearchWP
You can start by getting your copy of SearchWP here.
Once done, go over to the Downloads tab in your SearchWP account.
Press the Download SearchWP button and save the plugin to your computer.
After getting SearchWP, you will get an email with your license key. Open the email and save the key to the clipboard, as you’ll need it soon.
Now, go into your WordPress dashboard and upload the SearchWP plugin ZIP file.
Not sure how to do this? Kindly check out this step-by-step guide on how to install a WordPress plugin.
Once you get SearchWP installed and activated, the next step is to activate your license key.
To get started, click the SearchWP button that popped up on the top bar of your WordPress dashboard.
Once you’re in the SearchWP settings, go over to the License tab.
Paste your plugin license key and press the Activate button.
That’s it. You activated the plugin and can proceed to the next step below.
Step 2: Set Up Your Search Engine Settings
Now we need to set up the WordPress search engine. By editing its setting you can completely customize the way WordPress performs searches.
You can imagine it as if you were setting up a Google search algorithm, but for your particular site.
To do so, switch to the Engines tab in the SearchWP settings.
There are 3 default search sources: posts, pages, and media files. Each of them has a separate setting section with an attributes weight multiplier.
By changing the weight of these attributes, you can choose which ones WordPress search engine should give the highest priority.
For example, if you set the lowest weight for the content attribute, WordPress will barely consider it when performing a search.
To completely exclude posts or pages from appearing in search results, you need to remove them from the search engine’s sources list.
To do that, press the Sources & Settings button.
Then uncheck the Posts or Pages checkbox, depending on what you want to exclude, and click Done.
Don’t forget to press the Save Engines button once you’re finished.
Step 3: Test Your New Search with Excluded Pages
Now you want to test your new WordPress search if it’s excluding what you want it to exclude.
To do that, press the Visit Site button under your site’s name.
For the purposes of this tutorial, we created a page with the title “Why WordPress is the best CMS in the world?”. Let’s see if the new search finds it.
As you can see, no matches were found.
It means that the changes we made have taken effect and WordPress doesn’t include any pages in the search results anymore.
How to Exclude Specific Pages, Posts, or Custom Post Types from Site Search Results
Now let’s take a look at how you can exclude particular posts, pages, or custom post types from your WordPress site’s search results.
Step 1: Install and Activate SearchWP
The first step is to install and activate the SearchWP plugin. You can grab your copy of SearchWP here.
Earlier in this article, we’ve already described in detail how to install SearchWP on your website so check out this tutorial if necessary.
Step 2: Install and Activate Exclude UI Extension
After activating SearchWP, the next step is to download the SearchWP extension called Exclude UI. You can grab it on the Exclude UI download page after logging into your SearchWP account.
Once on the download page, press the Download Extension button.
Then install and activate the extension the same way you installed the SearchWP plugin above.
Step 3: Exclude the Specific Page, Post, or Custom Post Type
To exclude a specific post, page, or custom post type from search results, you need to open it in the editor and set the corresponding attribute. Let’s talk about how you can do these below.
How to Exclude Specific Page from Search Results
To exclude a page from WordPress search results, go to your dashboard and click Pages.
Find the page you’d like to hide from search results and click on it.
Once you open the page, click on the Page option and check the Exclude from search box in the right-hand menu.
After you’re done, click the Update, Publish or Save button at the top right to save the changes.
That’s it. Now this page won’t be displayed among your website’s search results.
How to Exclude Specific Post from Search Results
To exclude a post from WordPress search results, go to your dashboard and click Posts.
Find the post you’d like to hide from search results and click on it.
Once you open the post, click on the Post option. Then, make sure to check the Exclude from search box in the right-hand menu.
As you’re done, press the Update, Publish or Save button at the top right to save the changes.
That’s it. Now, this post won’t show up in the search results of your WordPress website.
How to Exclude Specific Custom Post Type from Search Results
To exclude a specific custom post type from WordPress search results, go to the plugin’s tab whose custom post you want to exclude.
For example, for the purposes of this tutorial, we’ll show you how to hide the WooCommerce product post.
First, go to the Products tab in your WordPress dashboard.
Find the product you want to hide from search results and click on it.
Once you open the post, check the Exclude from search box at the right.
Don’t forget to click the Update, Publish or Save button at the top right to save the changes.
In this article, you learned how to exclude pages, posts, and custom post types from site search results in WordPress.
If you’re ready to start customizing your WordPress website search engine, you can grab your copy of SearchWP here.
You can also check our guide on how to add custom fields search in WordPress with 3 simple steps.
An eCommerce WordPress website owner? It might be useful for you to learn how to add a WooCommerce search form to your shop page.