Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search goes to infinite loop with Astra theme.


  • glisky
    Participant

    @glisky

    Hi! When I use the search function on the forums page, or try to visit a search URL, it goes to an infinite loop which crashes the site. I have the latest version of everything, wp, Elementor, Astra and bbpress. Any ideas?

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

  • Robin W
    Moderator

    @robin-w

    so can you just clarify that with just bbpress plugin, elementor and astra theme – this happens?

    the standard fault finding is:

    it could be a theme or plugin issue

    Themes

    As a test switch to a default theme such as twentytwenty, and see if this fixes.

    Plugins

    If that doesn’t work, also deactivate all plugins apart from bbpress and see if this fixes. if it does, re-enable one at a time to see which is causing the error.

    If you cannot do this to your site (say because it is live) then use the ‘troubleshooting’ features of this plugin to let you test without affecting other users

    Health Check & Troubleshooting

    Then come back


    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.


    Robin W
    Moderator

    @robin-w

    any chance that you could post the code you developed?


    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/">


    Robin W
    Moderator

    @robin-w

    great – thanks for posting.


    Robin W
    Moderator

    @robin-w

    I spent a couple of hours yesterday hunting down the issue.

    This code fixes it :

    add_filter ('astra_single_layout_one_banner_visibility', 'astra_bbpress_fix', 50) ;
    
    function astra_bbpress_fix ($value) {
    	if( class_exists( 'bbpress' ) ) {
    		if (bbp_is_single_user()) return false ;
    		if (bbp_is_search()) return false ;
    	}
    return $value ;
    }

    Put this in your child theme’s function file –

    ie wp-content/themes/%your-theme-name%/functions.php

    where %your-theme-name% is the name of your theme

    or use

    Code Snippets


    Robin W
    Moderator

    @robin-w

    for others finding this thread – if you have the additional bbp-style-pack plugin – and why would you not have this 🙂

    bbp style pack

    then this fix is available at a single click – so not coding or other plugins needed.

    once activated just go to

    dashboard>settings>bbp style pack and click the theme support button

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