Replace deprecated who
argument from user query
#39986
Labels
Needs Technical Feedback
Needs testing from a developer perspective.
[Package] Block library
/packages/block-library
[Package] Editor
/packages/editor
REST API Interaction
Related to REST API
[Type] Enhancement
A suggestion for improvement.
What problem does this address?
In WordPress 5.9 the
who
argument has been deprecated. Trac TicketGutenberg is still using the
who
argument and recommending it to be used.gutenberg/packages/editor/src/components/post-author/constants.js
Line 2 in 08cf4a9
gutenberg/packages/block-library/src/avatar/user-control.js
Line 11 in 23f11a1
gutenberg/packages/block-library/src/query/edit/inspector-controls/author-control.js
Line 15 in 08cf4a9
gutenberg/packages/block-library/src/post-author/edit.js
Line 43 in 760815a
gutenberg/packages/core-data/README.md
Line 26 in 711ea0e
What is your proposed solution?
My suggestion would be to use the capability argument. The following code snippet fetches the
edit_post
capability for the current post type. This code is only compatible with WordPress 5.9. Either Gutenberg will need to increase the minimum supported version or include a check and a fallback withwho: 'authors'
.So that everyone does not have to figure out the
edit_post
capability, it might be best to create a helper function. Though in WordPress 5.9 thegetAuthors
function was deprecated #33725Related Issues: #39035 & #17364
The text was updated successfully, but these errors were encountered: