Support » Plugins and Hacks » Can't get Author ID outside the loop

  • 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?

    Thanks

  • The topic ‘Can't get Author ID outside the loop’ is closed to new replies.