Skip to:
Content
Pages
Categories
Search
Top
Bottom

Only show topics in search results for bbpress 2.0

  • @mweatherill

    Member

    I’ve added the following to my theme functions to include topics, posts and replies in search result:

    // Add Forums, Topics and Replies to search results
    function my_add_bbp_to_search( $post_type ) {
    $post_type['exclude_from_search'] = false;
    return $post_type;
    }
    add_filter( 'bbp_register_forum_post_type', 'my_add_bbp_to_search' );
    add_filter( 'bbp_register_topic_post_type', 'my_add_bbp_to_search' );
    add_filter( 'bbp_register_reply_post_type', 'my_add_bbp_to_search' );

    My frustration is that my search results are flooded with replies whilst I would prefer to only show each topic once. I’m willing to write a plugin to implement this “GROUP BY parent” logic but I’m not too sure how to approach the problem. Can anyone point me in the right direction for the filters that I need to intercept?

  • You must be logged in to reply to this topic.
Skip to toolbar