Get Post Author by Post id WordPress

Last Updated On Sunday 19th Dec 2021
  • WordPress doesn’t have a function to get post’s Author.
  • You can call to get the user ID for the author of a post.
 * @param int $post_id Post ID.
 * @return int Post author ID.
function get_post_author( $post_id ) {
  return get_post_field( 'post_author', $post_id );
  • get_post_author() function results in slightly better and more readable code.