WP_Query will not display draft posts
I'm trying to get WP_Query
to display ALL posts in an array but only ones with status published are showing:
global $wp_query;
$ids = array(130, 132);
$args = array(
'post_status' = array('publish', 'pending', 'draft', 'auto-draft', 'future', 'private', 'inherit'),
// 'post_status' = 'any', // same output
'post__in' = $ids,
'post_type' = 'alpha'
);
$q = new WP_Query($args);
foreach ($q-posts as $post) {
echo $post-id;
}
However this displays post id's regardless of their status:
// post status
foreach ($ids as $id) {
echo get_post_status($id);
}
This is fresh install of the Bones theme with no plugins. How do I display all posts in the array regardless of status? I must be missing something in the codex...
Topic post-status wp-query Wordpress
Category Web