Skip to content

Author in post panel show '(No author)' for editors in some cases #69921

@karthikeya-io

Description

@karthikeya-io

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.

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

Image

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions