Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: bbp-search on a single forum

@talbotp

Participant

Hey Robin, Thanks for the reply, really appreciate it. I added this to my themes functions.php (from the article above), but hardcoded in a forum_id, just to test it out, and it doesn’t seem to work.


function my_bbp_filter_search_results( $r ){
    $forum_id = 1715;

    if( $forum_id && is_numeric( $forum_id ) ){
 
        $r['meta_query'] = array(
            array(
                'key' => '_bbp_forum_id',
                'value' => $forum_id,    // 1715 x , 11 , 1717 , 
                'compare' => '=',
            )
        );
         
    }

    error_log('Dedicated forum = ' . $forum_id);
 
    return $r;
}
add_filter( 'bbp_after_has_search_results_parse_args' , 'my_bbp_filter_search_results' );

the error log is coming through when the page is loaded, but i’m still getting discussions from other forums in the search results.

Skip to toolbar