crsikes01 (@crsikes01)

Forum Replies Created

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

  • crsikes01
    Participant

    @crsikes01

    Certainly. This is the code to generate the new shortcode in functions.php or wherever your custom code is located:

    add_shortcode( 'custom_bbp-search', 'custom_bbp_search_shortcode' );
    function custom_bbp_search_shortcode( $atts ) {
    	$search_string = str_replace("-", " ", sanitize_title($_GET['bbp_search']));
            return do_shortcode( '[bbp-search search="'. $search_string .'"]' );
    }

    For the new page, just set up a new page (I called mine Forum Search with a url of /forum-search/) with the shortcode [custom_bbp-search] added.

    Finally, for the search form template, just copy wp-content/plugins/bbpress/templates/default/bbpress/form-search.php into wp-content/themes/[mythemename]/bbpress/form-search.php and replace the opening <form> line with the following:

    <form role="search" method="get" id="bbp-search-form" action="/forum-search/">


    crsikes01
    Participant

    @crsikes01

    I have a site that was experiencing the same exact issue. I wasn’t able to determine the root cause, but I did manage to develop a workaround.

    1. Create a new custom shortcode that captures url search term parameters and sends them to the default bbp-search shortcode’s search parameter.

    2. Create a new page that includes the new shortcode from step 1.

    3. Modify the search form from the template forum-search.php such that the action is now the page created in step 2.

    It is a bit wonky but it seems to work fine, including the search result pagination. It doesn’t address the root cause of the 500 error but at least site users can use the forum search now.

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