Unlocking WordPress: A Step-by-Step Guide to Adding Custom Post Types to Search Results

include-custon-post-types-in-wordpress-search-og

Want to include custom post types in WordPress search results? Follow this quick tutorial on how to include custom post types in your WordPress search results.

Custom post types play a crucial role in organizing and showcasing various types of content, such as portfolios, testimonials, and products.

By default, WordPress search results do not include custom post types, which can result in valuable content being overlooked.

At CanadaCreate, we understand the significance of making your entire content library easily searchable. Our blog utilizes custom post types and ensures they are included in search results, allowing our readers to effortlessly discover and engage with the content they seek.

In this article, we will guide you through the process of incorporating custom post types into WordPress search results with ease.

The Importance of Including Custom Post Types in WordPress Search

By default, the custom post types you create on your WordPress site are excluded from search results.

This limitation arises because the default WordPress search functionality is restricted and does not index content from custom post types.

For instance, if you have written movie reviews using your Movies custom post type, your visitors won’t be able to locate these reviews through the search feature on your WordPress blog.

By opting to include custom post types in your search results, you enhance the ability for users to find your content, thereby improving the overall user experience.

Incorporating custom post types into search results can enhance your website’s visibility.

Now, let’s explore how to seamlessly add custom post types to WordPress search results.

Guide to Adding Custom Post Types in WordPress Search

The simplest method to add custom post types to WordPress search is by utilizing the SearchWP plugin.

This is the top-rated custom search plugin for WordPress, trusted by more than 30,000 websites.

Our testing revealed that it is user-friendly and allows you to search content that isn’t included in the standard WordPress search. For more details, check out our SearchWP review.

To add custom post types to WordPress search, you must install and activate the SearchWP plugin. If you need assistance, refer to our guide on installing a WordPress plugin.

After activation, navigate to the SearchWP » Settings section in the WordPress admin sidebar and input your license key.

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

You can now configure SearchWP to include custom post types in your WordPress search results.

To accomplish this, go to the SearchWP » Algorithm section in the WordPress dashboard and locate the ‘Default’ panel.

This screen displays various content types on your WordPress site that SearchWP includes in its search results, such as media, posts, and pages.

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

This action will bring up the ‘Edit Settings (Default engine)’ prompt on your website.

In the ‘Sources’ section, you will find a list of all your post types, along with comments, media, and more.

Locate the custom post types you wish to include in your search results and check their corresponding boxes.

For instance, if you want to add the ‘Movies’ custom post type, simply check the box next to it.

After making your selections, click the ‘Done’ button.

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

In each section, SearchWP displays all the attributes it will consider when searching through your custom post types.

For every attribute, SearchWP provides an ‘Applicable Attribute Relevance’ scale, indicating the importance assigned to that attribute during searches of your custom post types.

By default, the sliders for ‘Title,’ ‘Slug,’ and ‘Excerpt’ are positioned to the far right, indicating they carry the most importance. The slider for ‘Content’ is centered, signifying it has a lesser impact.

If you wish to adjust the importance of an attribute, simply drag the corresponding slider to your preferred position.

Experimenting with different relevancy settings can help you find the most precise and useful search results.

You can also choose to exclude certain attributes. For instance, if your custom post type includes attributes meant solely for internal reference, you may want SearchWP to disregard them.

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

This action will bring up a new prompt where you can select the checkbox next to an attribute to make it searchable.

Conversely, if you prefer SearchWP to ignore a specific attribute, simply uncheck its box.

If you’ve created any custom taxonomies or fields, you may want SearchWP to include this content when searching your custom post types.

To accomplish this, click on either ‘Custom Fields’ or ‘Taxonomies.’ Then, enter the name of the attribute you wish to add and select it from the list that appears.

For comprehensive guidance, check out our tutorial on making custom fields searchable in WordPress.

Once you are satisfied with your settings, click the ‘Done’ button.

If you’ve added any attributes, custom fields, or taxonomies, you can adjust the weight of that attribute by sliding the control to the right for increased importance.

This adjustment means that the attribute will significantly influence the search results.

After customizing SearchWP’s settings, scroll to the top of the page.

Then, click the ‘Save’ button to apply your changes.

At this stage, SearchWP may notify you with the message ‘The index needs to be rebuilt.’

If you encounter this message, click the ‘Rebuild Index’ button located in the right column of the screen.

This action will incorporate your custom post types into your site’s search index, ensuring they appear in search results.

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

For additional tips on optimizing SearchWP’s advanced settings, please refer to our step-by-step guide on enhancing WordPress search with SearchWP.

Integrate a Search Form into Your WordPress Website as a Widget.

If your WordPress site already includes a search form, SearchWP will seamlessly replace it with an improved version.

If you haven’t added a search form yet, navigate to the Appearance » Widgets section in the WordPress admin dashboard.

Once there, click the ‘Add Block’ (+) button located at the top left corner to access the block menu.

Locate the ‘Search’ block and add it to your website’s sidebar.

SearchWP will then automatically enhance the standard WordPress search with its superior search form.

Finally, click the ‘Update’ button to save your changes.

Now, visit your website to see the improved search results powered by SearchWP.

Integrate a Search Form into Your WordPress Website Using Full Site Editor

If you’re using a block-based theme, you will have access to a full site editor.

To add a search form, go to the Appearance » Editor section from the WordPress admin sidebar.

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

The default WordPress search block will be automatically replaced with the enhanced search form from SearchWP.

Finally, click the ‘Save’ button to apply your changes.

Now, go to your website and use the search form to look for custom post types.

With SearchWP, you can create a search form that exclusively displays results from your custom post type category, making it easier for visitors to find what they need.

For more information, refer to our detailed guide on creating an advanced search form in WordPress for custom post types.

Bonus: Implement Fuzzy Search in WordPress

In addition to adding custom post types to WordPress search, you might want to enable fuzzy search. This feature helps users find the information they seek, even if they make spelling mistakes in their search queries.

A fuzzy search looks for partial matches to a search term and displays the closest results when no exact matches are found.

To enable fuzzy search in SearchWP, navigate to theSearchWP » Settingspage in the WordPress dashboard and scroll down to the ‘General Settings’ section.

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

After completing this step, the feature will be seamlessly integrated into your search form. For comprehensive guidance, check out our tutorial on implementing fuzzy search in WordPress to enhance search results.

We trust this article has helped you understand how to incorporate custom post types into WordPress search results. Additionally, feel free to explore our guide on switching custom post types in WordPress and our tutorial on adding icons for custom post types.

If you found this article helpful, consider subscribing to our YouTube Channel for informative WordPress video tutorials. You can also connect with us on Twitter and Facebook.

Share This Post