Skip to content

Instantly share code, notes, and snippets.

@httpstersk
Created February 20, 2019 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save httpstersk/f95aba0b969bba6f7c55154bfd095df6 to your computer and use it in GitHub Desktop.
Save httpstersk/f95aba0b969bba6f7c55154bfd095df6 to your computer and use it in GitHub Desktop.
➋➎ Get the post author's display name
const { select } = wp.data;
const { getAuthors } = select( 'core' );
const { getEditedPostAttribute } = select( 'core/editor' );
const authorID = getEditedPostAttribute( 'author' );
const { name } = getAuthors().find(a => a.id === authorID);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment