Skip to content

Fix visibility filtering across post types - #223

Open
cs1m0n wants to merge 4 commits into
masterfrom
feature/post-filter-fixes
Open

Fix visibility filtering across post types#223
cs1m0n wants to merge 4 commits into
masterfrom
feature/post-filter-fixes

Conversation

@cs1m0n

Copy link
Copy Markdown
Member

Route login visibility rules through posts_where so mixed post-type queries keep unsupported types visible while still filtering supported content. This also preserves filtering for suppressed-filter queries via the existing meta query fallback and avoids skipping secondary single-post queries.

Route login visibility rules through `posts_where` so mixed post-type queries keep unsupported types visible while still filtering supported content. This also preserves filtering for suppressed-filter queries via the existing meta query fallback and avoids skipping secondary single-post queries.

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new unsupported-post-type detection is inconsistent with the existing intent to exclude nav_menu_item from visibility filtering, which can cause menu items to be filtered incorrectly in mixed post-type queries.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR adjusts the login-based content visibility filtering to work correctly for queries that span multiple post types, by moving the main visibility constraints into a posts_where subquery so unsupported post types are not inadvertently excluded.

Changes:

  • Adds a posts_where filter that applies the visibility rules via a subquery scoped to an aliased posts table.
  • Updates pre_get_posts handling to avoid skipping secondary singular queries while leaving main singular handling to on_template_redirect().
  • Improves post-type support detection for array / any post type queries and introduces unsupported post-type detection for mixed queries.
File summaries
FileDescription
plugins/bcc-login/includes/class-bcc-login-visibility.phpRoutes visibility rules through posts_where for mixed post-type queries and refines post-type support/unsupported handling.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment threadplugins/bcc-login/includes/class-bcc-login-visibility.php
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A first-order meta rule can be discarded, bypassing visibility filtering.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment threadplugins/bcc-login/includes/class-bcc-login-visibility.php
cs1m0nand others added 2 commits September 7, 2026 15:56
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Ensure visibility filters are always passed as clause groups instead of bare first-order clauses. This prevents WP_Meta_Query from silently dropping rules and leaving queries unfiltered, and aligns both the default visibility branch and subquery SQL builder with the expected input shape.
@cs1m0n
cs1m0n requested a review from rvanoordSeptember 9, 2026 05:36
Sign up for freeto 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.

2 participants

@cs1m0n