Starting with version 1.30.0, FiboSearch now supports displaying custom post types (CPTs) in search results.
Table of Contents
- Enabling search for custom post types
- Searching in custom post type description
- Showing CPT images in the search results
- Displaying custom post types on the search results page
Enabling search for custom post types
Enabling search for custom post types involves three essential steps:
- Register the CPT with FiboSearch.
- Select the custom post type in the FiboSearch settings.
- Rebuild the search index.
The following instructions will walk you through each step.
To include custom post types in your search results with FiboSearch, you need to register them using the code provided below. This example demonstrates how to register two custom post types: testimonial
and designer
. There are two methods for registration: the first allows you to register using the CPT’s slug, while the second method enables you to define custom labels that FiboSearch will display in the search results.
add_filter( 'dgwt/wcas/indexer/post_types', function ( $post_types ) { $post_types[] = 'testimonial'; $post_types[] = [ 'post_type' => 'designer', 'labels' => [ 'name' => 'Designers', 'singular_name' => 'Designer', ] ]; return $post_types; } );
ⓘLearn how to add this snippet to your WordPress.
Replace testimonial
and designer
with the slugs of your custom post types.
Once the code is added, navigate to WooCommerce
> FiboSearch
> Autocomplete
and select the custom post types you want to search within under the “Non-products in autocomplete” section:

Save the settings and allow the search index to rebuild. Once the index is rebuilt, you will be able to search for your custom post types:

Searching in custom post type description
By default, FiboSearch searches only in CPT titles. If you want to search within the description as well, use this code:
add_filter( 'dgwt/wcas/indexer/post_source_query/testimonial/description', '__return_true' );
ⓘLearn how to add this snippet to your WordPress.
Make sure to change testimonial
to the correct CPT slug.
After adding the code, go to WooCommerce
→ FiboSearch
→ Indexer (tab)
and rebuild the index.
Showing CPT images in the search results
To show images of custom post types in the search results, add the following code to your website:
<?php // [SHORTINIT MODE] add_filter( 'dgwt/wcas/search_results/designer/show_image', '__return_true' );
ⓘLearn how to add this snippet in the special SHORTINIT mode.
Replace designer
with your CPT slug.
As a result, FiboSearch will show CPT images in the autocomplete:

Displaying custom post types on the search results page
By default, the WooCommerce search results page only shows products. To display custom post types on the results page, use the [fibosearch_posts_results]
shortcode with the appropriate parameters. Here’s an example of how to add the shortcode:
add_action( 'woocommerce_no_products_found', function () { if ( ! \DgoraWcas\Helpers::isProductSearchPage() ) { return; } echo do_shortcode( '[fibosearch_posts_results post_type="designer" layout=grid show_image]' ); echo do_shortcode( '[fibosearch_posts_results post_type="testimonial" layout=grid show_image]' ); } ); add_action( 'woocommerce_before_shop_loop', function () { if ( ! \DgoraWcas\Helpers::isProductSearchPage() ) { return; } echo do_shortcode( '[fibosearch_posts_results post_type="designer" layout=grid show_image]' ); echo do_shortcode( '[fibosearch_posts_results post_type="testimonial" layout=grid show_image]' ); } );
ⓘLearn how to add this snippet to your WordPress.
You can also use this shortcode with your page builder. For Elementor, there is a “FiboSearch Posts Search Results” widget, which allows you to select the post types to display:
