BuddyBoss 404 Errors
Some BuddyBoss users report spontaneous 404 errors across multiple, or all, pages and posts that is resolved by re-saving permalinks in WP admin. If these 404 errors occur on your website, debugging can be challenging, and for many of us, the exact cause has yet to be determined.
A solution that has been offered by the community is to flush the permalinks when a 404 error is received. That way, if the 404 is a mistake that can be resolved by flushing the permalinks, the visitor will be directed to the expected page. The code below can be added to your child theme’s functions.php to achieve this.
function flush_perma_on_404(){
//flush permalinks if user gets 404
if( is_404() ){
global $wp;
$check = get_transient( 'permalinks_flushed_recently' );
if ( $check === false ) {
flush_rewrite_rules();
set_transient( 'permalinks_flushed_recently', 'yes', 50 * MINUTE_IN_SECONDS );
wp_redirect(home_url( $wp->request ));
exit;
}
}
}
add_action( 'template_redirect', 'flush_perma_on_404' );

One of the challenges we’re experiencing with this code snippet is that opcache may have to be manually flushed depending on your hosting provider.