Can't query a single private post? (2 posts)

  1. lainga9
    Posted 3 years ago #

    I am having trouble trying to query a single private post. I have created a custom post type called dogs, some of which are published and some of which are private.

    I can query all of the dogs using the following code:

    $args = array ('post_type' => 'dog', 'post_status' => array('publish', 'private')); $male_q = new WP_Query($args);

    However, if I specify a name, for example:

    $args = array ('post_type' => 'dog', 'name' => 'bouncer', post_status' => array('publish', 'private')); $male_q = new WP_Query($args);

    then the query returns nothing.

    Any thoughts?

  2. lainga9
    Posted 3 years ago #

    note: the missing quote before post_status in the above post is just a typo.

Topic Closed

This topic has been closed to new replies.

About this Topic