WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to retrieve all custom post types created by the current user.

I have this piece of code:


$args_my_items = array(
    'posts_per_page' => 10,
    'post_type' => 'mycustomposttype',
    'post_author' => $current_user->ID);


What ends up being returned are all posts of type "mycustomposttype". It does not filter by post_author.

Am I using the wrong query parameters? How can I filter by the current user?


share|improve this question
up vote 1 down vote accepted

You must specify the author parameter as described here. Try to use:

$args_my_items = array(
    'posts_per_page' => 10,
    'post_type' => 'mycustomposttype',
    'author' => $current_user->ID

share|improve this answer
Awesome. Thank you. I looked at the post table and I saw a column labeled 'post_author' so i thought that would work. I wonder why the parameter does not match the table column. – rexposadas Apr 15 '11 at 22:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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