WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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

Your Answer


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.