WP Query to get all posts (including in draft/pending review)

I currently have the following query:

$args = array(
              'post_type' => 'post',
              'orderby'   => 'title',
              'order'     => 'ASC',
              'posts_per_page' => 10,
            );

$my_query = new WP_Query($args);

while ($my_query->have_posts()) : $my_query->the_post(); ?>

This returns all the posts that are published. How can I alter it to show every post whether it’s published, pending, or in draft?

Related posts

Leave a Reply

2 comments

  1. Also you can customize for pending and drafts or any selected status

    $args = array(
                  'post_type' => 'post',
                  'orderby'   => 'title',
                  'order'     => 'ASC',
                  'post_status' => array( 'pending', 'draft', 'future' ),
                  'posts_per_page' => 10,
                );