How to get Author ID outside the loop

Question

I can’t get the post author ID outside the loop to make the get_the_author_meta work. So far I’ve tried different approaches:

1.

$author_id=$post->post_author;

2.

global $post;
$author_id=$post->post_author;

3.

$post_tmp = get_post($post_id);
$author_id = $post_tmp->post_author;

4.

$author_id = $posts[0]->post_author;

I need the author ID to pass it on to:

$address = get_the_author_meta('user_email', $author_id);

Any suggestions?

0
, , Marce Castro 9 years 2012-09-18T14:29:22-05:00 0 Answers 120 views 0

Leave an answer

Browse
Browse