You can use the post_status parameter:
* 'publish' - a published post or page
* 'pending' - post is pending review
* 'draft' - a post in draft status
* 'auto-draft' - a newly created post, with no content
* 'future' - a post to publish in the future
* 'private' - not visible to users who are not logged in
* 'inherit' - a revision. see get_children.
* 'trash' - post is in trashbin. added with Version 2.9.
I’m not sure that it accepts ‘any’ so use an array with all of the statuses you want:
$args = array(
'post_type' => 'my-post-type',
'post_author' => $current_user->ID,
'post_status' => array('publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit', 'trash')
);
$query = new WP_Query($args);
while ( $query->have_posts() ) : $query->the_post();
Related Posts:
- How can i get count from query post
- query_post by title?
- How to set posts per page using WP_Query()
- query_posts() in function makes global $wp_query out of sync?
- Problem with ‘post__not_in’
- Sort posts alphabetically by custom field value, insert divider between different letters
- Is it better practice to use query_posts, WP_Query, or get_posts to create various custom loops within a Page?
- Custom Post Type “Event”: chronological list of recurring events
- Total Count of Posts NOT in Selected Categories?
- How to Get All Posts but the Private ones?
- Order posts using a custom array
- Tricky WP Query
- WordPress pagination showing same posts on each page
- Search breaks when querying main loop for category
- Using ajax with paging and a custom sub-query
- Custom loops, sticky posts, and pagination nightmare
- odd behaviours from template tags
- Having an issue doing a WP_Query with post_content and category__and
- Custom query looking at multiple custom fields and properly sorting
- Pre-existing arguments when using queries
- How to refine WP-Query with further criteria
- Run second query on page based on author of the first query
- Query Posts (post meta)
- Query Posts in a Predefined Order
- Custom Taxonomy not working with posts_per_page in new WP_query (pagination problem)
- Modify main WordPress loop with a parse_query filter
- Retrieving 3 latest post from each of 5 different custom post types
- how to group custom post type posts by custom taxonomy terms
- How to use filter hook posts_join for querying taxonomy terms in posts_where?
- How can I style future post?
- How to sort by meta value?
- Display one latest post from multiple categories
- Example Query Posts Showing the Latest Post with the Featured Image
- why do drafts return as part of wp_query?
- How to Loop within a Loop (Display Children and then Grandchildren)
- WP query exclude post within the last month / only show over 1 month old
- WordPress query for most recent posts from multiple categories
- Too many posts cause slow load when paginating
- How to order results by date and meta key?
- Order by value in serialized custom field
- Author Page Custom Query WHERE author OR [post meta value] OR [post meta value]
- posts_per_page => 1 shows 2 posts
- Show individual author rank from query of cumulative post view count for all authors
- How to paginate posts correctly that belong to a particular category and are random ordered
- WP_Query last five posts, simply ordered by meta_value
- WP_Query “OR”: Find posts by ID, Name or Post Title?
- How to filter query to display posts from parent category only?
- Archive for custom taxonomy lists all posts instead of current taxonomy
- WP_Query condition affects posts_per_page count
- Display random post on a page with post permalink in URL
- WordPress pagination with get_posts?
- query_posts() on key’s value, or key’s existence
- Slow page loads due to WordPress Core Query
- posts_per_page option limits the number of Gallery items
- Does the WP_Query ‘private’ argument for post status only apply to privately published content?
- Is there a better way to pull in custom content without querying posts?
- Reset WordPress Post Query to default
- Filter Loop by Custom Field Value
- Display custom post type by custom taxonomy
- WordPress wp_get_attachment_thumb_url full
- How to change default post type / post to media or attachments
- How to give classname to post if post has no content?
- WordPress post filter menu
- postsperpage value not being applied
- Query Products & Store IDs in array
- Creating attachments archive in tags and categories
- query_posts orderby multiple ways
- Pagination linking to first page
- new WP_Query issues
- Posts being viewed
- Posts limit on homepage (genesis framework)
- show all in query_posts on category.php?
- Query Posts Incorrectly Displaying Tags Archives
- Best Query for blog posts
- Most Effective Method? Exclude Category and Number of Posts Per Page
- post var problem with shortcode loop
- How do i create a custom post query when the meta value is an array?
- Get posts for each user
- Query for current post
- Custom query to retrieve oldest post and retrieve others with date interval
- Sorting query_posts() with a complex orderby filter
- How to show post title in content editor in backend?
- Pull new posts using feed
- Pull posts from all categories if quantity is not met?
- Query_post 5 post first / last of post_id
- Sort / Filter Queries
- query_posts() with multiple meta data comparisons
- How do I control the fallback query after the original query returned cero posts?
- Adding a category at even positions on main loop with modified pagination
- Converting an existing query_posts to WP_Query
- WordPress Query showing multiple titles
- custom query to get posts
- get_next_posts_link() stops displaying at page 4
- WP-Snap too slow (caused by WP_Query?)
- Multiple post queries -category,posts per page,orderby
- How to can I search range of products using between
- send user to first page of results when reposting to page?
- get all posts with certain meta data
- Integrating custom API for post content into Admin interface & Public Website [closed]
- How do I find the first item in the post array?