Description
Under certain circumstances, the author autocomplete search can fail to return the searched-for author. This is because of the way it's implemented. It uses the REST API author search and then filters those results by author name. Since the REST API author search also searches over the user email field, on sites with a lot of users having the same email domain, those email domain-related results can fill up all of the results in the API response, and the client-side filtering of the search results will say that nothing is found. The steps to reproduce explain this better and why it's an issue.
This issue mainly affects large sites with, for example, a few hundred users with employe.name@example.com email addresses and also a catch-all Example.com user account for posting things that don't fall under any specific author. The catch-all Example.com user account will not show up in the author autocomplete search in this situation (it will display nothing when searching for Example.com).
My recommendation would be to exclude email addresses in the REST API search that the author autocomplete uses.
Step-by-step reproduction instructions
-
Generate 500 users. (wp user generate --count=500 --role=author). Give them all an example.com email address (update wp_users set user_email = 'blah@example.com' where user_email = '';).
-
Go to the last page of the Users list in WP Admin and edit the 500th user. Change their nickname and display name to User Example:


- Go to a post. Open the network inspector. Type in
example as the author search. Observe that all of the REST API responses are generated users that have example.com in the email address, and the actual "User Example" user does not show up in the autocomplete -- in fact nothing shows up in the autocomplete, since none of the 50 users in the REST API response have Example in the name (they all have example in their email address though).

- Type in
user example as the author search. Observe that the result comes up nicely:

Screenshots, screen recording, code snippet
See steps to reproduce
Environment info
Tested with WP 5.9, running the version of Gutenberg that shipped with it. Tested with a clean WP site running no additional plugins. Environment was MacBook Pro and Chrome, though that shouldn't affect this issue.
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
Description
Under certain circumstances, the author autocomplete search can fail to return the searched-for author. This is because of the way it's implemented. It uses the REST API author search and then filters those results by author name. Since the REST API author search also searches over the user email field, on sites with a lot of users having the same email domain, those email domain-related results can fill up all of the results in the API response, and the client-side filtering of the search results will say that nothing is found. The steps to reproduce explain this better and why it's an issue.
This issue mainly affects large sites with, for example, a few hundred users with
employe.name@example.comemail addresses and also a catch-allExample.comuser account for posting things that don't fall under any specific author. The catch-allExample.comuser account will not show up in the author autocomplete search in this situation (it will display nothing when searching forExample.com).My recommendation would be to exclude email addresses in the REST API search that the author autocomplete uses.
Step-by-step reproduction instructions
Generate 500 users. (
wp user generate --count=500 --role=author). Give them all anexample.comemail address (update wp_users set user_email = 'blah@example.com' where user_email = '';).Go to the last page of the Users list in WP Admin and edit the 500th user. Change their nickname and display name to
User Example:exampleas the author search. Observe that all of the REST API responses are generated users that haveexample.comin the email address, and the actual "User Example" user does not show up in the autocomplete -- in fact nothing shows up in the autocomplete, since none of the 50 users in the REST API response haveExamplein the name (they all haveexamplein their email address though).user exampleas the author search. Observe that the result comes up nicely:Screenshots, screen recording, code snippet
See steps to reproduce
Environment info
Tested with WP 5.9, running the version of Gutenberg that shipped with it. Tested with a clean WP site running no additional plugins. Environment was MacBook Pro and Chrome, though that shouldn't affect this issue.
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