Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

My WP query to fetch some custom posts should exclude private posts, but this query is returning all posts, not just public ones:

$wp_query = new WP_Query( 'post_type=listing&post_status!=private&posts_per_page=9&meta_key=location_level1_value&orderby=location_level1_value&order=ASC&paged='.$paged);

I've also tried using post_status=-private, but that didn't work either...

What have I done wrong?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

I have to wonder if post_status=public would successfully exclude. That way it's just targeting the public posts.

share|improve this answer
    
It does, except then I also include empty "Auto Draft" posts –  Amanda Oct 18 '10 at 23:07
    
But post_status=publish does the trick... thanks –  Amanda Oct 18 '10 at 23:14
    
You're welcome Amanda –  tw2113 Oct 19 '10 at 2:31
    
Except that post_status=publish WILL include private posts if the user happens to be logged in. –  David Jan 16 '13 at 19:35
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.