SearchWP Blog

WordPress Tutorials, Tips, and Resources to Help Grow Your Business

How to fix custom post type search not working in WordPress

Custom post types help you organize different types of content on your WordPress site, like products, testimonials, or team members.

But there’s one frustrating issue: custom post types don’t show up in WordPress search results by default.

So you might wonder, how to fix custom post type search not working in WordPress?

It can be challenging, as there are a lot of possible reasons why this might be happening.

In this article, we’ll show you the most popular reasons why your custom post type may not appear in search results and how to fix them.

Why Custom Post Type Search Does Not Work?

Custom post types are popular among WordPress site owners.

Adding them allows you to go beyond standard posts and pages and turn WordPress into a full-fledged content management system.

Specifically, you’re free to name a custom post whatever you want and add custom fields containing any additional information to it.

It allows you to publish recipes, reviews, tutorials, and other types of content.

Here is an example of a custom post type:

an example of a custom post type

But if your visitors can’t search by custom post types, it hardly makes sense to publish them, as they won’t get any views.

Below, you’ll find the 3 most common examples of why search by custom post types may not work on your site.

1. WordPress Doesn’t Show Custom Post Type in Search Results

By default, WordPress will include custom post types in the search results, as long as you’ve not made them hidden using a plugin. 

However, the default search has many limitations and it often doesn’t show relevant results. 

So if you try to search for content that’s a custom post type, then chances are that you might get accurate results. 

To tackle this issue and make your custom post types searchable, you can use a search plugin and improve the default search process.

2. You Hid Your Custom Post Type from Search

The easiest way to create a custom post type is to use a WordPress plugin.

But many plugins have a feature that lets you choose whether you want the custom post type to be visible in search or not.

So, if you changed this parameter, then it may be the reason your custom post type doesn’t appear in search results.

3. Plugin Compatibility Issue

Added a custom post type to your site using a plugin, but it doesn’t appear in search results?

The possible reason may be a plugin compatibility issue.

When two or more plugins conflict with one another, it can cause problems which would lead to custom post type not appearing in search results.

How to Fix Custom Post Type Search Not Working in WordPress

Now that you know why search by custom post types might not work on your WordPress site, let’s look at possible ways to solve this problem.

1. Make WordPress Search by Custom Post Types

The easiest way to make WordPress search by custom post types is to use a plugin like SearchWP.

SearchWP

It is the best search plugin for WordPress and is a comprehensive solution that allows you to get complete control over how search works across your site. Beyond making custom post types searchable, it has tons of useful features.

For example, using SearchWP, you can display search results in live mode, add a search bar with a shortcode, and much more.

SearchWP boosts your on-site search by helping you:

  • Prioritize specific search results: Would you like to put a specific page at the top of search results on your site? SearchWP allows you to manually affect the search results order, so you can easily swap them around.
  • Exclude specific pages from search results: Are there some pages you’d prefer to hide from search? Using SearchWP, you can do that with a few clicks, no coding needed.
  • Track searches of your visitors: Wondering what search terms visitors enter on your site? SearchWP collects data about search activity on your site so you can understand your audience’s interests better.
  • Create custom search forms: Do you want to create a customized search form? With SearchWP, you can fully customize a search form to meet your needs and then add it to any place on your site.

Now, let’s look at how to make WordPress consider custom post types when searching with SearchWP.

Step 1: Install and Activate SearchWP

To get started, you’ll need to grab a copy of SearchWP by visiting the website and creating a new account.

Once done, simply navigate to your SearchWP account and go over to the Downloads tab.

Download SearchWP plugin from account area

Then, press the Download SearchWP button and save the plugin’s ZIP file to your computer.

After that, you can also copy your license key at the bottom left on the same tab. You’ll need it further to activate the plugin.

When you finish downloading, the next step is to upload the SearchWP plugin’s ZIP file to your site.

If you need help with this, then check out the how to install a WordPress plugin step-by-step guide.

Upon activation, you’ll see the SearchWP welcome screen. Go ahead and click the ‘Start Onboarding Wizard’ button and follow the steps in the wizard.

Onboarding wizard SearchWP

After you set up SearchWP, the next step is to add your custom post type as a search source.

Step 2: Add Your Custom Post Type as a Search Source

To do that, you can go to SearchWP » Algorithm from the WordPress admin panel.

By default, there is only one search engine called Default. You can customize the default engine and change how the search works throughout your site.

For example, you can change what types of content WordPress considers when searching, exclude specific categories or pages, and more.

As you can see, currently, this search engine performs searches by 3 sources: posts, pages, and media.

To make WordPress search by a custom post type, we need to add it as a search source as well. To do that, you can press the Sources & Settings button.

Edit or add new search engines in WordPress

After that, you’ll see the window where you can choose search sources you want WordPress to take into account while searching.

Simply find your custom post type among these sources and tick the box next to it to add it as a search source.

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

Select custom post type source

When you’re finished, go ahead and click the Done button.

Next, you can press the Save button at the top right to store the changes you’ve made.

Save engine settings

That’s it. You’ve successfully added a custom post type to your site search. The next step is to try out your customized search engine.

Step 3: Test Your New Search

To do that, simply visit your website and search for the custom post type.

For example, on our test site, we’ve added the ‘How to install a WordPress plugin’ post as the Tutorial custom post type.

Let’s search for it and see if it appears in search results.

press Find Results

The search form should show the custom post type.

As you can see, it found the post.

we found the custom post type

This means that the search engine now considers custom post types and searches by them.

How to Reveal Your Custom Post Type in Search Results

Added your custom post type as a search source following the guide above, but it still doesn’t appear in search?

If you’ve created a custom post type using a plugin, then there is a good chance you accidentally changed its visibility settings within the plugin.

For example, we’ll show you how to check it on the Custom Post Type UI plugin.

First, you’ll need to navigate to CPT UI » Add/Edit Post Types in the left panel of your WordPress dashboard.

press Add Edit Post Types

Here, you will see options to create a new custom post type.

Once there, you can switch to the Edit Post Types tab.

go over to the Edit Post Types tab

After that, you will need to choose a custom post you want to edit from the dropdown menu at the top left.

In this example, we’ll select the Tutorials custom post type.

choose your custom post type

Once you’ve selected the desired custom post type, scroll down to the Settings section and navigate to the Exclude From Search option.

make sure you didn't exclude your post from search

Make sure that it’s set to False.

If not, then simply switch it from True to False to make the selected custom post type display in search on your site.

How to Fix the Plugin Compatibility Issue

Have you tried all the guides above, but your custom post type is still not showing up in the search results? Another possible reason for that is a plugin conflict.

The easiest way to check if it’s the case is to deactivate each plugin in turn until you find the one that’s causing the problem.

To get started, go over to the Plugins tab in the left panel of your WordPress dashboard.

go to Plugins

Then, tick the checkbox next to each installed plugin except SearchWP and the plugin you used to add a custom post type.

Once that’s done, you can choose the Deactivate option from the Bulk actions drop-down menu and press Apply.

deactivate all plugins

After deactivating the plugins, check if the issue with displaying custom post types in search disappeared.

If so, you can start activating the plugins gradually one by one. It’ll allow you to find out which one is causing the problem and avoid using it in the future.

We hope this article helped you learn how to fix custom post type search not working in WordPress. You may also want to see our guide on how to fix WordPress search not working and how to fix WooCommerce product search not working.

If you’re ready to make custom post types searchable on your site and ensure a better search experience for your visitors, then you can grab your copy of SearchWP here.

author avatar
Aazim Akhtar

Create a Better WordPress Search Experience Today

Never lose visitors to unhelpful search results again. SearchWP makes creating your own smart WordPress search fast and easy.

Get SearchWP Now
Multiple Search Engines Icon