SearchWP

News

how to limit search to specific post types in WordPress

Are you looking for a way to limit search to specific post types in WordPress?

Typically, it requires extensive coding experience since there is no such feature in WordPress by default.

In this article, we’ll show you the easiest way to limit search on your site to specific post types with no coding needed.

Let’s dive into it!

Why Limit Search to Specific Post Types in WordPress

Limiting searches to certain types of posts on your site brings many advantages.

The main of them is it allows you to deliver more relevant search results to your visitors, making their user experience better.

For example, if you run a cooking blog, you can limit the search on your site to only recipes to make it easier to browse your site.

an example of a custom post type

In addition, limiting search on your site to a certain post type will help you to:

  • Boost your content discoverability. If visitors quickly find what they were looking for on your site, it encourages them to explore more of your content.
  • Get better positions in search engines. How easy it is to find the right content on your site directly affects the average session duration, which is one of the main ranking factors in Google.
  • Increase your conversion rate. If you’re an eCommerce site owner, you can limit search on your site to products only to make it easier to browse your store and increase the revenue.

Now that you know why to limit the search on your site to specific types of posts, let’s see how you can do that.

How to Limit Search to Specific Post Types in WordPress

The easiest way to limit search to specific post types in WordPress is to use a plugin like SearchWP.

SearchWP logo

SearchWP is the best WordPress search plugin on the market, with over 30,000 active installs.

Using it, you can limit search on your site to specific post types in just a few clicks, no coding needed.

But this is not the only thing you can do with this plugin. In fact, SearchWP allows you to get complete control over how search works on your site.

For example, you can prioritize specific search results, display search results in live mode, and more.

Here are some other SearchWP features that will help you to make search on your site better:

  • Make custom fields searchable. Use custom post types to publish your content? There is a lot of useful data within their custom fields, which you can make searchable with SearchWP.
  • Add a search bar with a shortcode. Looking for a way to put a search bar inside the post or page? Using SearchWP, you can add a customized search bar with a shortcode to any place in your article.
  • Exclude specific pages from search results. Want to hide some posts or pages from search results on your site? With SearchWP, you can do that with just a few clicks.
  • Track searches on your site. Would you like to track your visitors’ searches? SearchWP collects data on all search activity on your site so that you can learn more about your audience.

Now that you know why using SearchWP is the easiest way to limit search on your site to specific post types, let’s see how you can do that below.

Step 1: Install and Activate SearchWP

The first step is to get your copy of SearchWP here.

Then, log into your SearchWP account and go over to the Downloads tab.

go to the Downloads tab

Once there, press the Download SearchWP button to begin downloading the plugin’s ZIP file to your computer.

press Download SearchWP

When you’re finished downloading, copy your license key on the same tab. You’ll need it to activate your SearchWP license a bit further.

copy your license key

The next step is to upload the downloaded file to your site and install the plugin.

Not sure how to do that? You can follow this step-by-step guide on how to install a WordPress plugin.

After the plugin installation, go to your WordPress dashboard. Then, point a cursor over the SearchWP button, and click Activate License.

click Activate License

Then, paste your SearchWP license key into the License tab and press Activate.

press Activate

Once you activate the plugin, you’re ready to start customizing your search engine.

Step 2: Customize Your Search Engine

To get started, go over to the Engines tab.

go over to the Engines tab

On this tab, you can manage search engines created with SearchWP.

the list of your search engines

By default, there is only one search engine called Default. You can customize how search works across your site by editing its setting.

For example, you can exclude from search specific pages or categories, adjust the post attributes’ relevance weight, and more.

Plus, SearchWP allows you to add an unlimited number of search engines and link them to separate search fields.

This lets you create customized search forms with a unique set of settings and place them anywhere on your site.

Since we want to limit search to specific post types on our entire site, we’ll customize the Default search engine.

To get started, press the Sources & Settings button.

click Sources and Settings

Here you can select which search sources you want WordPress to consider. By default, there are 3 active sources: Posts, Pages, and Media.

search sources

To limit search on your site to a specific post type, you’ll need to uncheck all other sources except it.

For example, we have a custom post type on our test site called Tutorials.

Let’s say that we want to limit search to it. To do that, we’ll check this source and leave it as the only active one.

Here is how it looks on our test site:

how to limit search to specific post types in WordPress

When you’ve finished setting up your search sources, click Done.

That’s it. Now search on your site is limited to the selected post type.

The last step is to click the Save Engines button to save the changes you’ve made to the Default search engine.

press Save Engines

Now let’s try your new search.

Step 3: Test Your New Search Limited to Specific Post Types

To do that, press the Visit Site button under your site’s name in the top left corner of your dashboard.

click Visit Site

For the purposes of this guide, we’ve added a Tutorial custom post type called “How to install a WordPress theme”.

Let’s try to search for it and see what we’ll find, given the fact we also have a lot of other posts types about WordPress.

search for a custom post type

As you can see, there are no results except our custom post type, to which we’ve limited search on our site.

we found our custom post type

To make sure that our search is truly limited to the Tutorial custom post type, we should also try to search for other post types.

For example, we have a regular post on our site called “Why WordPress is the most powerful CMS”.

Let’s try to find it using our customized search engine.

search for a regular post

As you can see, we haven’t found any results.

there are no regular posts in the search results

It means that we successfully limited search on our site to a certain post type.

In this article, you learned how to limit search to specific post types in WordPress. It’ll help you to give your visitors more relevant search results and improve their user experience.

If you’re ready to limit search on your WordPress site to specific post types, you can grab your copy of SearchWP here.

Would you like to make your search results page better? Check out the how to customize your WordPress search results page detailed guide.

Are you wondering how to add a custom search form to your website? Follow the how to create a custom search form in WordPress tutorial.

Want to make your search awesome right now?

More than 30,000 sites have chosen SearchWP!

You can utilize all of the content that’s gone unrecognized by native WordPress keyword search instantly with SearchWP.

Get SearchWP for just $99

  • Committed Support
    If you need help, support is fast, friendly, and here for you
  • Streamlined Setup
    Installation and setup that’s optimized for speed
  • Great Documentation
    Helpful, clear, and usable documentation is a priority

See what SearchWP customers have to say

  • “Great plugin! I implemented a bulk product search option for my wholesale platform. I was supported very quickly by the SearchWP team, and we met our complex goals. Recommended!”

  • “The ability to setup search engines specific to my custom post types is so badass! Combine that with the awesome related posts extension… beautiful match. Nice work!”

  • “With SearchWP, you can add weight to categories, tags, taxonomies and even custom fields. This yields a much better and richer search than the basic WP search. My clients love it.”