1

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

5

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'   
             );` 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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