bp_search_helpers_cpts( array $helpers )
Load search helpers for each searchable custom post type.
Description
Parameters
- $helpers
-
(Required)
Return
(array)
Source
File: bp-search/plugins/search-cpt/index.php
function bp_search_helpers_cpts( $helpers ) { $post_types = get_post_types( [ 'public' => true ] ); $custom_handler_cpts = [ 'post', 'forum', 'topic', 'reply' ]; foreach ( $post_types as $post_type ) { //if name starts with cpt- if ( ! in_array( $post_type, $custom_handler_cpts ) && bp_is_search_post_type_enable( $post_type, 0 ) ) { $searchable_type = 'cpt-' . $post_type; $cpt_obj = get_post_type_object( $post_type ); //is cpt still valid? if ( $cpt_obj && ! is_wp_error( $cpt_obj ) ) { require_once buddypress()->plugin_dir . 'bp-search/plugins/search-cpt/class-bp-search-cpt.php'; $helpers[ $searchable_type ] = new BP_Search_CPT( $post_type, $searchable_type ); BP_Search::instance()->searchable_items[] = $searchable_type; } } } return $helpers; }
Changelog
Version | Description |
---|---|
BuddyBoss 1.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.