Skip to content

Fallback to default sidebar behavior when forum sidebar is not configured#306

Draft
RachelRVasquez wants to merge 1 commit into
strangerstudios:devfrom
RachelRVasquez:bbpress-sidebar-fix
Draft

Fallback to default sidebar behavior when forum sidebar is not configured#306
RachelRVasquez wants to merge 1 commit into
strangerstudios:devfrom
RachelRVasquez:bbpress-sidebar-fix

Conversation

@RachelRVasquez
Copy link
Copy Markdown
Collaborator

@RachelRVasquez RachelRVasquez commented May 27, 2026

All Submissions:

Changes proposed in this Pull Request:

Bug: bbPress pages show empty sidebar column when no forum CPT sidebar is configured

Problem

On bbPress forum pages, the sidebar column would render visibly in the layout (respecting the Customizer layout settings) but contain no widgets.

The cause was in memberlite_get_widget_areas() in inc/sidebars.php. For bbPress pages, the function unconditionally replaced the default widget areas with the result of memberlite_get_default_sidebar_by_post_type( 'forum' ):

$widget_areas = array( memberlite_get_default_sidebar_by_post_type( 'forum' ) );

When no forum-specific CPT sidebar had been configured in Memberlite → Custom Sidebars, that function returns false, resulting in $widget_areas = array( false ). Calling dynamic_sidebar( false ) renders nothing, leaving the sidebar column empty even though the layout expected content there.

Fix

Guard the override so it only applies when a valid forum CPT sidebar is actually configured. If none is set (or the value is the 'memberlite_sidebar_default' sentinel), $widget_areas is left unchanged, falling back to sidebar-2 (Posts & Archives) as it would for any other non-page, non-blog context.

$forum_sidebar = memberlite_get_default_sidebar_by_post_type( 'forum' );
if ( ! empty( $forum_sidebar ) && 'memberlite_sidebar_default' !== $forum_sidebar ) {
    $widget_areas = array( $forum_sidebar );
}

Behavior After Fix

Forum CPT sidebar setting Before After
Not configured Empty sidebar column Falls back to sidebar-2
Configured to a specific sidebar Used that sidebar ✓ Used that sidebar ✓
Set to memberlite_sidebar_default Empty sidebar column Falls back to sidebar-2

How to test the changes in this Pull Request:

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you successfully run tests with your changes locally?

Changelog entry

Enter a summary of all changes on this Pull Request. This will appear in the changelog if accepted.

…o default sidebar behavior instead of rendering no sidebar
@RachelRVasquez RachelRVasquez changed the title fix so that when a forum sidebar is not configured, it'll fall back t… Fallback to default sidebar behavior when forum sidebar is not configured May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant