-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
Description
Trac ticket: https://core.trac.wordpress.org/ticket/56429
This issue occurs because here the getUsers
selector returns only the first 100 users. If there are more than 100 authors and the current post's author isn't included in the initial query result, that author isn't stored in the store.
gutenberg/packages/editor/src/components/post-author/hook.js
Lines 29 to 35 in 0c71098
return { | |
authorId: _authorId, | |
authors: getUsers( query ), | |
postAuthor: getUser( _authorId, BASE_QUERY ), | |
isLoading: isResolving( 'getUsers', [ query ] ), | |
}; | |
}, |
The code currently uses getUser
to fetch the post's author, which results in a request to /wp/v2/users/:id
. This request fails for Editors because they lack the list_users
capability, returning a 403 error — but it works for Administrators.
Step-by-step reproduction instructions
Please see: https://core.trac.wordpress.org/ticket/56429#comment:4
Note: Before PR #67330, the per_page value was 50. It's now 100. So, to reproduce the issue, make sure you have more than 100 users.
Screenshots, screen recording, code snippet
Environment info
No response
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