WordPress.org

Support

Support » How-To and Troubleshooting » Can't query a single private post?

Can't query a single private post?

  • lainga9

    @lainga9

    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?

Viewing 1 replies (of 1 total)
  • lainga9

    @lainga9

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

Viewing 1 replies (of 1 total)
  • The topic ‘Can't query a single private post?’ is closed to new replies.
Skip to toolbar