最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

post meta - Filter for author list in gutenberg core editor

programmeradmin0浏览0评论

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
Add a comment  | 

1 Answer 1

Reset to default 1

The 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.

发布评论

评论列表(0)

  1. 暂无评论