Forums

[resolved] How to exclude a post from the loop (3 posts)

  1. mhmtozek
    Member
    Posted 3 years ago #

    I've been struggling around since couple of days to figure out how to exclude a specific post (not category, just a post to be excluded) from the loop.

    Is there a way/hack with in the loop to exclude a specified post?

  2. Austin Matzko
    Member
    Posted 3 years ago #

    query_posts(array('post__not_in' => array(123)));

    excludes post ID 123.

  3. mhmtozek
    Member
    Posted 3 years ago #

    <?php query_posts(array('showposts'=> 3,'cat' => 27,'post__not_in' => array($thePostID))); ?>

    Worked like a charm, thank you very much filosofo

Topic Closed

This topic has been closed to new replies.

About this Topic