Do you want to know how to limit search to only posts in WordPress?
That can be very handy if you have a lot of pages on your website and want to reduce the amount of clutter in search results.
In this article, we’ll show you how to limit search to only posts in WordPress.
Let’s begin.
Why Limit Search to Only Posts on Your Site?
By default, WordPress displays all published pages, posts, and custom post types in search results.
That’s why sometimes it might be challenging to find the right piece of content, especially on sites with a bunch of pages.
Have you ever used a search form on a site and come across pages like “Sitemap”, “About”, “Checkout”, and so on among the regular results? Then you know this feeling.
If you’re a blogger, limiting search results to posts only will make it easier for your visitors to find the content they’re looking for.
It ensures a better user experience and reduces the bounce rate, one of the crucial ranking factors in Google.
Besides, satisfied users who found the right content on your site are more likely to return again and become the loyal audience.
Are you an online store owner? Technical pages in search results distract your customers from searching for products.
Removing these pages can improve conversion and make your store look more professional.
Now, let’s talk about how you can limit the search on your WordPress site to only posts.
How to Limit Search to Only Posts in WordPress
The fastest and easiest way to limit search to only posts in WordPress is to use a plugin like SearchWP.
Used by over 30,000 sites, SearchWP is the best WordPress search plugin. Using it, you can limit search on your site to only posts, pages, or custom posts types in a few clicks, without writing any code.
Some of its other features also include:
- Keyword stemming. Do you want to make your WordPress site recognize that search terms like “search” and “searching” are relevant to the same content? SearchWP allows you to enable search for matches related to the keywords you enter, just like in Google.
- Custom fields indexing. The native WordPress search engine doesn’t consider any data stored within the custom fields. It makes it impossible to search on sites that actively use custom post types properly. SearchWP allows you to tackle this issue and make custom fields searchable in a few clicks.
- Search activity tracking. Wonder what your visitors are searching for on your site? SearchWP gives you a full report on your visitors’ search behavior so you can better know your audience and meet their content needs.
Now, let’s proceed to the step-by-step tutorial on limiting search to only posts using the SearchWP plugin.
Step 1: Install and Activate SearchWP
The first step is to grab your copy of SearchWP here.
After that, navigate to the Downloads tab in your SearchWP account.
Once there, press the Download SearchWP button and save the plugin to your computer.
After you download the plugin, copy your license key as you’ll need it soon to activate your license.
Then, go to your WordPress site dashboard and upload the SearchWP plugin ZIP file.
Need help with that? Please check out the how to install a WordPress plugin step-by-step tutorial.
After installing and activating the plugin, click the SearchWP button at the top panel of the WordPress dashboard.
In the SearchWP settings, click the License tab.
Paste your license key into the appropriate field and press Activate.
That’s it. You’ve successfully activated your SearchWP license. Now, you can fully use SearchWP to improve search on your site.
Step 2: Customize the WordPress Search Engine
Now you’re ready to move to the next step and start customizing your WordPress search engine.
Think of a search engine as a set of rules that you can edit to control how search works on your site.
To get started, go over to the Engines tab in the SearchWP settings.
Here, you can customize your default search engine and add new ones.
For example, you can change the list of sources where WordPress searches. You can also adjust the weight of attributes that WordPress considers when performing a search.
It’s like you’re customizing the Google search algorithm but only for your site.
Now, to limit search to only posts, let’s just remove any other sources from the default search engine source list. This way, your search engine will consider only posts when performing a search.
To do so, press the Sources & Settings button at the top right.
Then uncheck the sources you’d like to remove. In our case, let’s uncheck Pages and Media, to leave Posts as the only active source.
After you’ve finished, click Done.
Then, press Save Engines to save the changes we’ve done.
That’s it. You’ve now successfully limited search on your site to posts only.
Step 3: Test Your New Search
Now, let’s test our customized search engine. For the purposes of this tutorial, we’ve created a post and page, both entitled “WordPress”.
In the parentheses next to their titles, we indicated what type of content they belong to. It will allow us to find out whether the search restriction works or not.
Now, let’s go over to the website and check what search results we’ll get after searching for “WordPress”.
First, click the Visit Site button under your site’s name.
Then, enter the search term you’d like to test into the search box on your website and press Search. In this example, we’ll search for “WordPress”.
As you can see, there is no “WordPress (Page)” among the search results.
It means that we’ve successfully excluded all types of content from search results, except for posts.
So, in this article, you learned how to easily limit search to only posts in WordPress.
Ready to limit search to only posts on your WordPress website – no coding needed? You can grab your copy of SearchWP here to get started.
Have any problems with search on your site? Check out this step-by-step tutorial on how to fix WordPress search not working.
Wondering how to add a search bar? Check out how to add a search bar in WordPress in 4 different ways.