Is there a filter to modify the presentation of certain editor editor components? For my example, I want to be able to filter the author list which is a select input in the Gutenberg editor on the document pane.
I know the component I want to modify is located here: .js
Is there a filter to modify the presentation of certain editor editor components? For my example, I want to be able to filter the author list which is a select input in the Gutenberg editor on the document pane.
I know the component I want to modify is located here: https://github/WordPress/gutenberg/blob/8517779feddf3de0b86465fae8f21f4384447c58/packages/editor/src/components/post-author/index.js
Share Improve this question asked Sep 6, 2019 at 23:58 Jim SchofieldJim Schofield 11 bronze badge 2- Which functionality you want to add? – BenB Commented Sep 7, 2019 at 1:44
- I want to be able to show more properties from the user object than just the pretty name. We have a case where we have multiple username slugs with the same pretty name, and so we need to show both in the select box – Jim Schofield Commented Sep 9, 2019 at 0:05
1 Answer
Reset to default 1The component post-author
uses getAuthors()
to get the authors, this functions calls the REST API.
export function* getAuthors() {
const users = yield apiFetch( { path: '/wp/v2/users/?who=authors&per_page=-1' } );
yield receiveUserQuery( 'authors', users );
}
So you can only filter via the REST API filter rest_user_query, but this can have effects on other plugins which also use this endpoint to get the user list.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745178642a4615315.html
评论列表(0条)