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

Author selector becomes unusable on sites with many authors #67331

Open
3 of 6 tasks
mreishus opened this issue Nov 26, 2024 · 0 comments · May be fixed by #67330
Open
3 of 6 tasks

Author selector becomes unusable on sites with many authors #67331

mreishus opened this issue Nov 26, 2024 · 0 comments · May be fixed by #67330
Labels
REST API Interaction Related to REST API [Type] Bug An existing feature does not function as intended

Comments

@mreishus
Copy link
Contributor

mreishus commented Nov 26, 2024

Description

The current author selector implementation has a few limitations that make it unusable on sites greatly exceeding 50 authors:

  1. The dropdown is limited to showing only 50 authors
  2. The search functionality is also limited to returning 50 results
  3. Search criteria mismatch between frontend and backend:
    • Backend (REST API) searches user_login, user_email, and user_nicename
    • Frontend filters differently, leading to inconsistent results
    • This means sometimes the backend can return 50 results and none of them appear on the frontend
  4. Including email in search can make results unusable if many authors share a common email domain and the search criteria matches the domain.
  5. No pagination or "Load more" functionality exists

Image

Image

Impact

Some authors are inaccessible.

If an author is not in the first 50 alphabetical entries, they can only be chosen if they are found by search. However, search limitations may make that impossible. Imagine the scenario of a company with 2000 authors with "@stevesburgers.com" email addresses. If you search "Steve", looking for "Steve Smith", it's quite likely that no results will be displayed. This is because the backend will return the first 50 users with "Steve" in their email - Likely employees with names beginning with A-C because they come first alphabetically - and the frontend will filter them all out, because the frontend is looking for the string "Steve" in the name fields, not the email. The actual "Steve Smith" user will not be returned by the backend since it's past the 50 user cutoff, and the frontend won't get a chance to render it.

Expected Behavior

  • All authors should be accessible

Technical Details

Current REST API endpoint (/wp/v2/sites/{site}/users) uses these arguments:

{
  "exclude": [],
  "include": [],
  "order": "asc",
  "number": 50,
  "search": "*search_term*",
  "offset": 0,
  "orderby": "display_name",
  "who": "authors"
}

The resulting SQL includes email in search:

WHERE (user_login LIKE '%term%' OR user_email LIKE '%term%' OR user_nicename LIKE '%term%')

Possible Solutions

  • Add pagination or "Load more"
  • Use consistent criteria between frontend/backend
  • Make the author limit configurable
  • Make search fields configurable (for example, turn off email domain matching)

Impact

This affects any WordPress site with more than 50 authors, but is particularly problematic for:

  • Multi-author news sites
  • Corporate blogs
  • Educational institutions
  • Any site where authors share an email domain

See Also

Note that #15994 is related but it doesn't seem to cover the frontend/backend search mismatch.

Step-by-step reproduction instructions

Steps to Reproduce

  1. Create a blank WordPress site
  2. Use the FakerPress plugin to add 500 users with Author role
  3. Open the post editor
  4. Try to assign an author who isn't in the first 50 alphabetically by scrolling down in the list.
  5. Try searching for a common string that would match many authors ("example" here - FakerPress puts this in their email domain)
  6. Notice:
  • You can't scroll past 50 authors
  • Search results are limited to 50
  • If you search for something matching the email domain, you get back authors A-C but can't reach later alphabetical authors

Screenshots, screen recording, code snippet

No response

Environment info

  • Gutenberg: 19.6.4
  • WordPress: 6.x+

Please confirm that you have searched existing issues in the repo.

  • Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • Yes

Please confirm which theme type you used for testing.

  • Block
  • Classic
  • Hybrid (e.g. classic with theme.json)
  • Not sure
@mreishus mreishus added the [Type] Bug An existing feature does not function as intended label Nov 26, 2024
@Mamaduka Mamaduka added the REST API Interaction Related to REST API label Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
REST API Interaction Related to REST API [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants