I am creating a front end dashboard where I need to show all the posts by the current user. So, I need to show posts in all states, mainly published
, trashed
and the pending
. I am now using a simple query but it is returning only the published posts.
$query = array(
'post_type' => 'my-post-type',
'post_author' => $current_user->ID
);
query_posts($query);
Can anyone help? What else do I need to do?
post_status
parameter, ie.'post_status' => 'any'
?WP_Query
pre_get_posts
orget_posts
instead ofquery_posts
. Never usequery_posts
WP_Query
for front-end, andget_posts
for admin queries as there is an issue withwp_reset_postdata
(see the note and ticket on this issue).