Support » Fixing WordPress » query_posts and trash items – strange

  • Hi, I noticed that those two queries produce different results, meaning that the one with the array also returns unwanted items from trash. Of course there is no need for array but it returns items from trash even if I specify the array as array('publish','draft'). I am not sure if this is only custom taxonomy related behaviour or a general one. I am using that in the author.php, hence the $curauth->ID and the rest.

    first one

    $dentfix_query = array (
    'post_type'=>array('statusdentar','tratamente'),
    'author'=>$curauth->ID,
    'post_status'=>'publish',
    'dinti'=>'1'.$e
    );
    query_posts( $dentfix_query );

    and second one

    $dentfix_query = array (
    'post_type'=>array('statusdentar','tratamente'),
    'author'=>$curauth->ID,
    'post_status'=>array('publish'),
    'dinti'=>'1'.$e
    );
    query_posts( $dentfix_query );

Viewing 2 replies - 1 through 2 (of 2 total)
  • pyrosix

    (@pyrosix)

    Hello, I have the exact same problem…
    If you or anyone else has found a solution please reply.

    Thanks.

    Hey guys, I had the same issue. Unfortunately for me, I needed to query multiple stati.

    Long story short, you can achieve this by passing a comma separated string for the value of post_status.

    ...
    'post_status'    => 'publish,pending',
    ...

    I submitted a ticket to trac, since the codex does state that an array is a valid way to pass the post_status argument.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘query_posts and trash items – strange’ is closed to new replies.