Skip to content

Member Content: Search: Exclude Restricted Content when include or p parameters present - #1279

Open
n7studios wants to merge 3 commits into
tests-woocommerce-price-selectorfrom
member-content-search-exclusion
Open

n7studios wants to merge 3 commits into
tests-woocommerce-price-selectorfrom
member-content-search-exclusion

Conversation

@n7studios

Copy link
Copy Markdown
Contributor

Summary

Fixes the 3.5.1 search exclusion for Member Content being bypassed

  • REST API include (and any post__in query): WordPress ignores post__not_in when post__in is set, so restricted Posts matching only their restricted content were still returned. Excluded Posts are now also excluded via posts_where, which can't be overridden.
  • Frontend ?p=<id>&s=<term>: is_search() is false when p is used, so the exclusion didn't run, while WordPress still applied the search term. The exclusion now runs whenever a search term is present.

Testing

  • testRESTAPISearchExcludesRestrictedContentMatchesWithInclude: Test /wp/v2/posts and /wp/v2/search with the include parameter don't return a restricted Post when the search only matches restricted content.
  • testSearchResultsRestrictedWithPostID: Test ?p=<id>&s=<term> doesn't return a restricted Post when the search only matches restricted content.

Checklist

@n7studios n7studios added this to the 3.5.2 milestone Nov 12, 2026
@n7studios n7studios self-assigned this Nov 12, 2026
@n7studios n7studios added the bug label Nov 12, 2026
@n7studios n7studios changed the title Member Content: Search: Exclude Restricted Content Matches When Include or P Parameters Are Used Member Content: Search: Exclude Restricted Content wheninclude or p parameters present Nov 12, 2026
@n7studios n7studios changed the title Member Content: Search: Exclude Restricted Content wheninclude or p parameters present Member Content: Search: Exclude Restricted Content when include or p parameters present Nov 12, 2026
@n7studios
n7studios changed the base branch from main to tests-woocommerce-price-selector November 12, 2026 07:51
@github-actions

Copy link
Copy Markdown

WordPress Playground

🚀 Your PR has been built and is ready for testing in WordPress Playground!

Click here to test your changes in WordPress Playground

@n7studios
n7studios marked this pull request as ready for review November 13, 2026 01:39
@n7studios
n7studios requested review from a team, ciccio-kit and noelherrick and removed request for a team November 13, 2026 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants