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.

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

Here is the current query.

<?php 
$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?

Marvellous

share|improve this question

1 Answer 1

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

 
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.