Skip to:
Content
Pages
Categories
Search
Top
Bottom

Merge search boxes of bbpress and wordpress?


  • AlbertFox
    Participant

    @albertfox

    Wordpress search box and bbpress forum search are disconnected. These operate independently. Is there any way for them to work together? although it should place some selector (radio button) to search at each of them using same box?

    Thanks for all 🙂

Viewing 2 replies - 1 through 2 (of 2 total)

  • Robkk
    Moderator

    @robkk

    you can add the bbpress post type to the default wordpress search.

    copy this into your child theme functions.php or a functionality plugin

    /**
     * Include bbPress 'topic' custom post type in WordPress' search results
     */
    function ntwb_bbp_topic_cpt_search( $topic_search ) {
    	$topic_search['exclude_from_search'] = false;
    	return $topic_search;
    }
    add_filter( 'bbp_register_topic_post_type', 'ntwb_bbp_topic_cpt_search' );
    
    /**
     * Include bbPress 'reply' custom post type in WordPress' search results
     */
    function ntwb_bbp_reply_cpt_search( $reply_search ) {
    	$reply_search['exclude_from_search'] = false;
    	return $reply_search;
    }
    add_filter( 'bbp_register_reply_post_type', 'ntwb_bbp_reply_cpt_search' );
    
    function ntwb_bbp_forum_cpt_search( $forum_search ) {
    $forum_search['exclude_from_search'] = false;
    return $forum_search;
    }
    add_filter( 'bbp_register_forum_post_type', 'ntwb_bbp_forum_cpt_search' );

    AilyRoot
    Participant

    @ailyroot

    This codes does allow both admin and normal user to search for both wp and forum contents fine.

    However normal user with no permission to certain forum could search for those articles in hidden forum too! and they could view the full fine from click link on search results, this is privacy alert!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Skip to toolbar