Skip to content

Post editor: Preload the author of the post summary #85118

Open

Description

@ntsekouras

Follow up of: #85081

The author field of the post summary queries the users collection with include: [ id ], who: 'authors' (AuthorView in core-fields), because the single user endpoint denies access to authors without published posts for users who can't list users (see trac ticket and GB PR).

We can't preload that request though. who is deprecated in WP_User_Query since 5.9 and preloading runs during the page render, so the deprecation notice gets printed in the editor page when WP_DEBUG is on.

So in #85081 and the core backport the author preload was removed, and the author is fetched after the editor loads.

When https://core.trac.wordpress.org/ticket/56429 is fixed we should:

  1. Switch AuthorView back to the single user request (for the WP versions that have the fix).
  2. Add the author preload back in the post editor.

There might be other options too, like mapping who=authors to a capability query in WP_REST_Users_Controller, or reading the author from the post record. Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions