get_posts not honoring post_status

Question

I have a custom post type ‘license’ with custom post statuses ‘active,inactive,cancel,expire’. However when I run a get_posts query to get only posts with active status it returns all the posts irrespective of the status.

$active_licenses = get_posts( array(
        'post_type' => 'license',
        'post_status'    => 'active',
        'posts_per_page' => -1,
        'orderby'        => 'ID',
        'order'          => 'DESC',

    ) );

I am unable to figure out what am I doing wrong.

0
Vijay Sharma 4 years 2020-03-23T16:52:58-05:00 0 Answers 97 views 0

Leave an answer

Browse
Browse