Forums

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

  1. mhmtozek
    Member
    Posted 11 months 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. filosofo
    Member
    Posted 11 months ago #

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

    excludes post ID 123.

  3. mhmtozek
    Member
    Posted 11 months ago #

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

    Worked like a charm, thank you very much filosofo

Reply

You must log in to post.

About this Topic