Hi,
I can't get the get_posts function to return both drafts and published posts. This is my code:
$args = array(
'numberposts' => NULL,
'offset' => 0,
'orderby' => 'title',
'order' => 'ASC',
'post_type' => 'post',
'post_status' => array('drafts', 'publish')
);
$Post_Array = get_posts($args);
If I run the function twice and combine the resulting arrays it works, but then the orderby is wrong because it just adds the second array to the end of the first array. Here is the code:
$args = array(
$args = array(
'numberposts' => NULL,
'offset' => 0,
'orderby' => 'title',
'order' => 'ASC',
'post_type' => 'post',
'post_status' => 'draft'
);
$Post_Array1 = get_posts($args);
$args = array(
'numberposts' => NULL,
'offset' => 0,
'orderby' => 'title',
'order' => 'ASC',
'post_type' => 'post',
'post_status' => 'publish'
);
$Post_Array2 = get_posts($args);
$Post_Array = array_merge((array)$Post_Array1, (array)$Post_Array2);