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

How would we query posts as long as the post does not equal the ID 2047?

Here is the current query.

$args1 = array(
    'post_type' => 'options',
    'tag_slug__and' => array( $triplevel, $divingtrip, 'accommodation' ),
    'posts_per_page' => -1,
    'offset' => 1,
query_posts( $args1 ); while (have_posts()) : the_post();

I tried this...

query_posts( $args1 . 'p!=2047' );

..to no effect.

Any ideas?


share|improve this question
up vote 3 down vote accepted

Most of the things you can do with a query are described in the Codex page for WP_Query

You need to use the 'post__not_in' parameter eg:

$args = array(    
              'post__not_in' => array('34','54'), // post ids   
              'post_type' => 'page'   
share|improve this answer

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.