WordPress.org

Ready to get started?Download WordPress

Forums

Exclude posts from query (3 posts)

  1. ReinoNL
    Member
    Posted 4 years ago #

    Is there a way the exclude posts (by id) from the query?
    Like:

    <?php
                    query_posts(array(
    				'p' => '-1307',
                    ));
                ?>

    Thanks!

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    <?php  $args = array (
    	'post__not_in' => array(1307)
    );
    query_posts($args); ?>

    http://codex.wordpress.org/Template_Tags/query_posts#Post_.26_Page_Parameters

  3. ReinoNL
    Member
    Posted 4 years ago #

    Thanks esmi!
    I should have figured this out myself, seen it before, think my brain got stuck :)

Topic Closed

This topic has been closed to new replies.

About this Topic