SearchWP

News

How to Fix Custom Post Type Search Not Working in WordPress

Are you wondering 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.

Let’s dive into it!

3 Common Examples of Custom Post Type Search Isn’t Working

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 to it custom fields containing any additional information.

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 and how to solve this issue.

WordPress Doesn’t Search by Custom Post Types by Default

The main reason why you can’t find your custom post type in the search results lies down in the features of WordPress.

The thing is, by default, it searches only by posts and pages.

As custom post types are different types of content, the native WordPress search engine ignores them while performing a search.

To tackle this issue and make your custom post types searchable, you need to add them to the default search source list.

We’ll show you how you can do that later in this article. Or, you can go over to the how to make WordPress search by custom post types detailed tutorial right now.

You Hid Your Custom Post Type from Search

The easiest way to create a custom post type is to use a WordPress plugin. For example, one of the most popular plugins for this purpose is Custom Post Type UI.

That’s a great plugin you can use to create a custom post type within minutes.

But it has a feature that lets you choose whether you want the custom post type you create to be visible in search or not.

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

We’ll show you how you can fix this issue later in this article. Or you can skip ahead to the solution and learn how to unhide your custom post type in search results right now.

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 the plugin compatibility issue. We’ll show you how to check that out later in this article.

Or, if you want to skip ahead, feel free to follow the how to fix the plugin compatibility issue link.

How to Fix Custom Post Type Search Not Working in WordPress

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

How to 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 logo

This 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 many 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, grab your copy of SearchWP here.

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

go over to the Downloads tab

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

press Download SearchWP

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

copy your license key

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

Need help with that? Check out the how to install a WordPress plugin step-by-step guide.

After installing the plugin, go to your WordPress dashboard and click SearchWP at the top bar.

click SearchWP

Then, navigate to the License tab.

navigate to the License tab

Paste your plugin’s license key into the License field and press the Activate button.

press Activate

After you activate your copy of 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, go over to the Engines tab.

go to the Engines tab

By default, there is only one search engine called Default.

the list of your search engines

By setting it up, you can customize how the search works throughout your entire site.

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

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

search sources

To make WordPress search by a custom post type, we need to add it as a search source as well.

To do that, press the Sources & Settings button.

press Sources and Settings

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

edit the search sources

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’ve added a custom post type called Tutorials, so we’ll tick it off.

tick the custom post type search source

When you’re finished, click Done.

press Done

Then, press the Save Engines button at the top right to save the changes you’ve made.

press Save Engines

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, click the Visit site button under your site’s name at the top left of the WordPress dashboard.

click Visit Site

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

As you can see, we found the post.

we found the custom post type

It means that the search engine on our test WordPress site now considers custom post types and searches by them.

How to Unhide 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, there is a good chance you accidentally changed its visibility settings.

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

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

press Add Edit Post Types

Once there, go over to the Edit Post Types tab.

go over to the Edit Post Types tab

Then, 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 the page down 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, 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. In our case, it’s Custom Post Type UI.

check the plugins you want to disable

Once done, choose the Deactivate option from the Bulk actions drop-down menu and press Apply.

deactivate all plugins

After deactivating the plugins, check if the problem 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.

In this article, you learned how to fix custom post type search not working in WordPress.

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

Have you faced any other problems with search on your site? Check out the how to fix WordPress search not working detailed guide.

Your WooCommerce products don’t appear in search results? Follow the how to fix WooCommerce product search not working 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

  • “We use SearchWP also on pages with a great number of subpages, articles, custom post types and fields. SearchWP works always reliable and offers great statistics for the admins – we love it.”

  • “I purchased Search WP for my site but I have limited coding abilities so I was having some difficulties and the Search WP support team went above and beyond to make sure my search functions were working perfectly, best support I’ve ever received!!”

  • “Powerful and flexible; excellent for building custom search engines and extending search across custom post types and fields. Intuitive and user-friendly interface; lots of add-ons; excellent API, documentation, and customer support to boot.”

[wpforms id="3080"]