Hi,
I am trying to show "draft" status single posts on my public site so that they do not show up in the blogroll but can be accessed directly if you know the premalink.
I hook into the template redirect action so that I can call WP_Query to get the post if it exists. For testing, I am using a specific post ID and I cannot get it to work. The code works perfectly for an "publish" status post ...
global $csk_query;
$csk_query = new WP_Query();
$args = array(
'p' => 433, // code works fine with 427 which is "publish"
'post_type' => 'my_custom_type',
'post_status' => 'draft'
);
$csk_query->query($args);
var_dump($csk_query->have_posts()); // this is false
while ( $csk_query->have_posts() ) : $csk_query->the_post();
the_title(); // does not get into loop ...
endwhile;
Is there is anything I am missing to set up the post data for draft posts or something. Have checked codex and can't see that I need to do anything specific for "draft" posts...
Any help much appreciated!