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 a trying to create a dashboard like custom page template that list post of of the current logged in user. I've tried to find a solution on the net. but none were appropriate

share|improve this question
up vote 5 down vote accepted

this should work for you:

if ( is_user_logged_in() ):

    global $current_user;
    $author_query = array('posts_per_page' => '-1','author' => $current_user->ID);
    $author_posts = new WP_Query($author_query);
    while($author_posts->have_posts()) : $author_posts->the_post();
        <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>       

else :

    echo "not logged in";

share|improve this answer
Thank you milo, works like a charm :) – nickfrancis.me Jul 23 '11 at 7:38
how to permalink the title, so that users can go to their post – nickfrancis.me Jul 23 '11 at 8:17
@nickfrancis.me - see edited answer – Milo Jul 23 '11 at 8:26
@Milo what would the code be to also include custom post types of the user? – Anagio Dec 21 '12 at 15:54

To include custom post time in the $author_query array, add another key=>value element to $author_query array.


$author_query = array(
   'posts_per_page' => '-1',
   'author' => $current_user->ID,
   'post_type'=>'your custom post type name'
share|improve this answer
Welcome to WPSE. Just a few notes to get you started: 1.) Always properly explain what your code does and how it works 2.) Please work on your code format when adding code. If you add code, highlight it in the code editor and click on the {} sign above the editor. Thank you – Pieter Goosen Oct 16 '14 at 18:11

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.