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

fix: return no posts for authors without term #2033

Merged
merged 1 commit into from
Jan 28, 2025

Conversation

leogermani
Copy link
Contributor

All Submissions:

Changes proposed in this Pull Request:

When using CAP, the HPP relies on the author terms to search for posts when filtered by authors.

As described in the docs, this requires the site to have created all terms for all authors in case they are missing, running wp co-authors-plus create-author-terms-for-posts.

However, for newly created users, or for users that are not authors of any posts, terms are not created.

The end result is that if you filter by such users, there will be no filter by the author taxonomy and all posts will be returned.

This PR fixes this.

How to test the changes in this Pull Request:

  1. on trunk
  2. Create a new user
  3. Add a HPP block anywhere and filter by this user.
  4. Note that all posts are returned
  5. checkout this branch
  6. note that no posts are returned, as expected

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@leogermani leogermani self-assigned this Jan 27, 2025
@leogermani leogermani requested a review from a team as a code owner January 27, 2025 20:09
@leogermani leogermani merged commit e331139 into trunk Jan 28, 2025
9 checks passed
@leogermani leogermani deleted the fix/hpp-author-no-posts branch January 28, 2025 13:54
Copy link

Hey @leogermani, good job getting this PR merged! 🎉

Now, the needs-changelog label has been added to it.

Please check if this PR needs to be included in the "Upcoming Changes" and "Release Notes" doc. If it doesn't, simply remove the label.

If it does, please add an entry to our shared document, with screenshots and testing instructions if applicable, then remove the label.

Thank you! ❤️

@leogermani
Copy link
Contributor Author

cherry picked to current alphas

matticbot pushed a commit that referenced this pull request Jan 28, 2025
## [4.5.7-alpha.2](v4.5.7-alpha.1...v4.5.7-alpha.2) (2025-01-28)

### Bug Fixes

* return no posts for authors without term ([#2033](#2033)) ([3b72633](3b72633))
matticbot pushed a commit that referenced this pull request Feb 3, 2025
## [4.5.9-alpha.1](v4.5.8...v4.5.9-alpha.1) (2025-02-03)

### Bug Fixes

* add supported gateways check ([#2009](#2009)) ([1462233](1462233))
* return no posts for authors without term ([#2033](#2033)) ([3b72633](3b72633))
matticbot pushed a commit that referenced this pull request Feb 3, 2025
## [4.5.9](v4.5.8...v4.5.9) (2025-02-03)

### Bug Fixes

* add supported gateways check ([#2009](#2009)) ([1462233](1462233))
* return no posts for authors without term ([#2033](#2033)) ([3b72633](3b72633))
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.

2 participants