Knowledge Base
  1. Home
  2. Knowledge Base
  3. Advanced Topics
  4. Searching additional post types from your Knowledge Base

Searching additional post types from your Knowledge Base

You can add the following custom code snippet to your to your (child) theme’s functions.php file. This example shows how to make posts searchable from your knowledge base, but you can add support for any in-built or custom post type.

 

[php]

//add filter
add_filter( ‘hkb_search_post_types’, ‘ht_code_snippets_add_posts_to_hkb_search’, 10, 1 );

function ht_code_snippets_add_posts_to_hkb_search( $search_post_types ){
//add the ‘post’ post type (you can add post, page etc)
$search_post_types[] = ‘post’;
return $search_post_types;
}

[/php]

 

 

Was this article helpful?
Related Articles