Why Does get_posts() Return an Empty Set?

It seems that is was a simple problem. get_posts() has various default settings, one of which is that the post_status is set to public and my custom post type which doesn’t use post_status used the default value, draft.

To fix this you can either query by post status (see the code below) or change the data in the DB.

$args = array(
    'post_status' => 'draft',
    'post_type'   => 'your_custom_post_type'
);

Leave a Comment