Skip to content

Instantly share code, notes, and snippets.

@tarikcayir
Created August 30, 2015 09:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tarikcayir/ec0f462a452f177b4f7e to your computer and use it in GitHub Desktop.
Save tarikcayir/ec0f462a452f177b4f7e to your computer and use it in GitHub Desktop.
WP_Query get draft posts!
<?php
// Query args.
$args = array(
'post_type' => array( 'post', 'page' ),
'post_status' => 'draft'
);
$query = new WP_Query( $args );
// Start the loop.
while ( $query->have_posts() ) : $query->the_post();
echo get_the_title().'<br/>';
// End the loop.
endwhile;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment