When I call post with get_post_meta I get all posts.I would like to get related post from user when using get_post_meta. How would I achieve this?

Example: If I am logged in as foo than I would like to get all posts by foo.

  • Sorry about my english. I got all post. That's what I don't want. Example I was login with Author and I would like to get author's post only. Which function do i have to use? – pico Dec 11 '15 at 10:56

Try to use get_posts()

$current_user = get_current_user_id();

$args = array(
    'post_type'   => 'post',
    'author'      => $current_user,
    'post_status' => 'publish',

$all_posts = get_posts( $args );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.