get post author id outside loop

The easiest way would be using get_post_field():

$post_author_id = get_post_field( 'post_author', $post_id );

For more details on this issue: have a look at this StackOverflow answer.

Leave a Comment