Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
in Q2A Core by

I noticed when you search in q2a with WP integration & BuddyPress (with pretty permalinks like site.com/123/question-title) your search will always be redirected to the root of wordpress and users won’t be able to search your Q2A site. It’s because there is no page defined to handle WP's search, so BuddyPress decides to automatically redirect URI with search keyword as a part of wordpress and you know what happens next.

Here is how you can solve it:

1. Open this file inside wordpress directory:


2. Find this line of code:

add_action( 'bp_init', 'bp_core_set_uri_globals',    2  );

3. Replace the code above with these 2 lines:

if (!defined('QA_VERSION'))
    add_action( 'bp_init', 'bp_core_set_uri_globals',    2  );

That’s all; it won’t affect you BuddyPress in any way and only will prevent BP's redirection when it's called through Q2A. If you want to go deep into it, here is the main code which actually prepares it for redirection:




    if ( !empty( $bp_uri[0] ) && ( bp_get_search_slug() == $bp_uri[0] ) ) {
        $matches[]   = 1;
        $match       = new stdClass;
        $match->key  = 'search';
        $match->slug = bp_get_search_slug();


Please log in or register to answer this question.