Uh oh!
There was an error while loading. Please reload this page.
Fix visibility filtering across post types - #223
Conversation
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.
There was a problem hiding this comment.
🟡 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_wherefilter that applies the visibility rules via a subquery scoped to an aliased posts table. - Updates
pre_get_postshandling to avoid skipping secondary singular queries while leaving main singular handling toon_template_redirect(). - Improves post-type support detection for array /
anypost type queries and introduces unsupported post-type detection for mixed queries.
File summaries
| File | Description |
|---|---|
| plugins/bcc-login/includes/class-bcc-login-visibility.php | Routes 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.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 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
Uh oh!
There was an error while loading. Please reload this page.
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.
Route login visibility rules through
posts_whereso 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.