add_action( 'pre_get_posts', 'ps_bp_doc_search' );
function ps_bp_doc_search( $query ) {
if ( $query->is_search ) {
$query->set( 'post_type', array( 'post', 'page', 'bp_doc') );
}
}
Please paste this function in your child theme’s functions.php. If there is no child theme then can use code snippets plugin https://wordpress.org/plugins/code-snippets/ to paste this snippet.
Hopefully, this will help you.
Thanks
Hello Prashant,
Thank you for your response. I am currently working with the code solution you provided. For some reason, the query->set is not updating the post_type attribute of the Query Object. Still debugging this. Will update soon. Thank You
Hi Prashant,
The above solution did not work. Including ‘bp_doc’ as a post type in the $query object did not make a difference in the search as ‘bp_doc’ does not exist as a post type. Tried to create custom post type ‘bp_doc’ but couldn’t figure out a way to link the post type to the document list.
Thank You
So is there any way I can Create a taxonomy or custom post type for the documents being uploaded through the Bp Group Documents plugin?
afaik, Bp Group Documents uses a custom table – not a custom post type.
So search integration will require filtering the WP search SQL.
And that is beyond the scope of these forums – therefore this thread will be closed.
You can contact the plugin creator thru their support forum.
You can find info on the web re filtering WP searches.
Or perhaps you could hire a developer.