Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update: Exclude password protected posts from search #1913

Closed
wants to merge 4 commits into from

Conversation

dinhtungdu
Copy link
Contributor

Description of the Change

This PR is a replacement for #1789. Instead of adding a new meta, we use has_password argument of WP_Query to control the visibility of protected posts.

By default, EP doesn't index password-protected posts. They will be indexed if Protected content feature is enabled. Again, only admin queries return protected posts; this PR introduces a new filter to enabled it on the frontend: ep_exclude_password_protected_from_search.

Alternate Designs

See #1789.

Benefits

Hide password-protected posts from search results.

Possible Drawbacks

None that I'm aware of.

Verification Process

Reindex site contains password protected posts with Protected Content enabled. See protected posts in the admin area but not on the frontend.

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Applicable Issues

Closes #1789

Changelog Entry

@dinhtungdu dinhtungdu self-assigned this Oct 9, 2020
@dinhtungdu
Copy link
Contributor Author

dinhtungdu commented Oct 9, 2020

@tlovett1 Excluding password-protected posts is not the default behavior of WordPress core but it makes sense to me. Should we respect core behavior here? Given that we can change it by using the new filter introduced in this PR.

@sagarsdeshmukh
Copy link

Is there any blocker in review & merging this PR?

@abdullah1908
Copy link

@dinhtungdu thank you so much for submitting MR. We'll surely take a look & bring under consideration while tech discussion would be continued.

@mckdemps mckdemps removed the request for review from tlovett1 February 26, 2021 18:18
@mckdemps mckdemps modified the milestones: 3.6.0, Future Release Jun 15, 2021
@rebeccahum
Copy link
Contributor

Hi all,

Any timeline or update on the status of this?

@mckdemps mckdemps modified the milestones: Future Release, 3.7.0 Sep 21, 2021
@felipeelia felipeelia removed this from the 3.7.0 milestone Oct 12, 2021
@felipeelia felipeelia added this to the 4.0.0 milestone Oct 12, 2021
@rebeccahum
Copy link
Contributor

Did some extensive testing on the current state of the PR and I found the below scenarios occurring:

Scenario 1

  1. Enable protected_content
  2. Create post
  3. Create another post with password
  4. Do front-end search for a term in post_content of step 3 and expect to see no post

At step 4, it actually shows the post. The only way to fix this is by running index --setup.

Scenario 2

Continuing from scenario 1, after running index --setup

  1. Remove password from passworded post
  2. Do front-end search and see post
  3. Add back password to same post in step 1)
  4. Repeat step 2)

At step 4, it still shows the passworded post as well.

Scenario 3

  1. Before protected_content is enabled, create one or two password-protected posts
  2. Run index with --setup
  3. Go to wp-admin and expect to see the password protected posts listed

At step 3, you do not see the password protected posts listed.

@oscarssanchez
Copy link
Contributor

closing in favor of #2408

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants