I am creating a back-end dashboard where I need to show all the post assigned to current user by the wp admin.
I assign user role to Author and while creating post (as a wp admin) just assign this post to some author from Author drop-down.
So I need to show posts with status Publish. I am now using simple query post but it is returning all posts.
global $current_user; get_currentuserinfo(); $user_id = $current_user->ID; // for current user it is 2 $query = array( 'post_type' => 'post', 'post_author' => $user_id, 'post_status' => array('publish') ); $my_posts = query_posts($query);
I also hard-coded post_author to 2
I also tried
$my_post = new WP_Query(array( 'post_author' => '2' ));