Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Include Custom Post Types in WordPress Search Results

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

Do you want to include custom post types in the WordPress search?

By default, WordPress will never show custom post types in its search results. That means your visitors may miss out on some great content, and you’ll miss out on extra page views.

In this article, we will show you how to easily include custom post types in WordPress search results.

How to include custom post types in WordPress search

Why Include Custom Post Types in WordPress Search?

By default, the custom post types that you have created on your WordPress website will not be included in the search results.

This is because the built-in WordPress search feature is quite limited and does not index the content that you have added in custom post types.

For example, if you have written some movie reviews under the Movies custom post type, then your visitors won’t be able to find these reviews in your WordPress blog search results.

No search result for custom post type content

However, if you decide to include custom post types in your WordPress search results, it will make it easier for users to find your content, improving user experience.

Moreover, including custom post types in search results can also improve your website visibility.

Having said that, let’s see how to easily include custom post types in WordPress search results.

How to Include Custom Post Types in WordPress Search

The easiest way to include custom post types in WordPress search is by using SearchWP.

It is the best custom search plugin for WordPress, used by over 30,000 websites. It’s easy to use and lets you search content that isn’t included in the default WordPress search.

To include custom post types in WordPress search, you’ll need to install and activate the SearchWP plugin. If you need help, then please see our guide on how to install a WordPress plugin.

Upon activation, head over to the SearchWP » Settings page from the WordPress admin sidebar and enter your license key.

You can find this information under your account page on the SearchWP website.

SearchWP license key

You can now set up SearchWP to include custom post types in WordPress search results.

To do this, head over to the SearchWP » Algorithm page from the WordPress dashboard and expand the ‘Default’ tab.

On this screen, you’ll see sections for the different types of content on your WordPress site that SearchWP includes in its search results. This includes your website’s media, posts, and pages.

To include custom post types, click the ‘Sources & Settings’ button.

Click the Sources and Settings button

This will open the ‘Edit Settings (Default engine)’ prompt on your website screen.

Here, you will see all your post types listed along with comments, media, and more under the ‘Sources’ section.

Now, simply find all of the custom post types that you want to include in your search results, and check their boxes.

For example, if you want to add the ‘Movies’ custom post type, then check the box next to that option.

Once you’ve done that, click on the ‘Done’ button.

Add custom post type from the prompt

You’ll now see a new section for each of your custom post types on your WordPress site added in the ‘Default’ tab.

In each section, SearchWP shows all the attributes that it will look at when searching your custom post types.

For each attribute, SearchWP has an ‘Applicable Attribute Relevance’ scale. This is the weight that SearchWP gives to this attribute when searching your custom post types.

By default, the sliders for Title, Slug, and Excerpt are all the way to the right, so they have the most weight. The slider for Content is in the center, so it has less weight.

However, if you want to change the weight of an attribute, then you can simply drag the slider next to it according to your liking.

Add weight to attributes

You may want to try different relevancy settings to see what gives you the most accurate and helpful search results.

You can also remove attributes. For example, your custom post type may have attributes that you want SearchWP to ignore, like attributes that you added for your internal reference only.

To add or remove attributes, click on the ‘Add/Remove Attributes’ button.

Click Add/Remove attributes button

This will open a new prompt on the screen where you can check the box next to an attribute to make it searchable.

Similarly, if you want SearchWP to ignore an attribute, then go ahead and uncheck its box.

Removing custom post type attributes from WordPress search

If you’ve created any custom taxonomies or custom fields, then you might want SearchWP to look at this content when searching your custom post types.

To do this, simply click on either the ‘Custom Fields’ or ‘Taxonomies’ fields. You can then type in the name of the attribute that you want to add, and click on it when it appears.

For detailed instructions, you may want to see our tutorial on how to make custom fields searchable in WordPress.

Adding custom post types in WordPress search

When you’re happy with your settings, click on the ‘Done’ button.

Now, if you’ve added any attributes, custom fields, or taxonomies, then you can change the weight of that attribute by moving the slider to the right to give it more weight.

This means that this attribute will have a bigger impact on the search results.

Assign weight to the custom attribute

Once you’ve finished customizing SearchWP’s settings, scroll to the top of the screen.

You can then click on the ‘Save’ button to store your changes.

Save settings for SearchWP

At this point, SearchWP may show you the message ‘The index needs to be rebuilt.’

If you see this message, then go ahead and click on the ‘Rebuild Index’ button in the right column of the screen.

This will add your custom post types to your site’s search index, so they will show up in the search results.

Click the Rebuild Index button

That’s it. WordPress will now include your custom post types in its search results.

For more tips on SearchWP’s advanced settings, please see our step-by-step guide on how to improve WordPress search with SearchWP.

Add a Search Form to Your WordPress Website as a Widget

If you already have a search form on your WordPress site, then SearchWP will automatically replace it.

However, if you haven’t added a search form to your website yet, then you need to visit the Appearance » Widgets page from the WordPress admin area.

Once you’re there, click the ‘Add Block’ (+) button at the top left corner of the screen to open the block menu.

From here, locate and add the ‘Search’ block to the website sidebar.

Search widget

SearchWP will now automatically replace the default WordPress search with its own better search form.

Finally, click the ‘Update’ button to store your settings.

Now visit your website to check out the results of your WordPress search with SearchWP.

Custom post type search results

Add a Search Form to Your WordPress Website Using Full Site Editor

If you’re using a block-based theme, then you’ll have a full site editor.

To add a search form, you have to visit the Appearance » Editor page from the WordPress admin sidebar.

Once there, click the ‘Add Block’ (+) to open the block menu and choose the ‘Search’ block.

Adding search block in site editor

The default WordPress search block will now be automatically replaced by the better search form of SearchWP.

Finally, click the ‘Save’ button to store your settings.

Now visit your website and search for custom post types using the search form.

Custom post type search results in FSE

With SearchWP, you can also create a search form that only shows the search results from your custom post type category, which can make it easier for visitors to find what they’re looking for.

For more details, see our step-by-step guide on how to create an advanced search form in WordPress for custom post types.

Bonus: Add Fuzzy Search in WordPress

Apart from adding custom post types in WordPress search, you may also want to enable fuzzy search. This feature allows users to easily find the information they are looking for even if they misspell their query.

A fuzzy search looks for partial matches for a search term and shows the closest results if no exact matches are available.

An example of fuzzy search on a WordPress website

To enable fuzzy search in SearchWP, head over to the SearchWP » Settings page from the WordPress dashboard and scroll down to the ‘General’ tab.

From here, simply toggle the switch next to the ‘Partial Matches’ option.

Toggle the Partial matches switch

Once you do that, the feature will be automatically added to your search form. For detailed instructions, you can see our tutorial on how to add fuzzy search in WordPress to improve results.

We hope this article helped you learn how to include custom post types in WordPress search results. You can also go through our guide on how to make money online blogging with WordPress and see our expert pick of must-have WordPress plugins for business sites.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

1 CommentLeave a Reply

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.