WordPress.org

Ready to get started?Download WordPress

Forums

Can't get Author ID outside the loop (1 post)

  1. MarceFX
    Member
    Posted 1 year ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic