• I have only a few blog posts on the site I am currently building, none of which are marked as sticky. Therefore I should expect no posts to show up from the below query:

    <?php
    	$args = array(
    		'post_type' => 'post',
    		'posts_per_page' => 2,
    		'post__in' => get_option('sticky_posts')
    	);
    ?>
    
    <?php query_posts($args); ?>
    <?php if(have_posts()) : ?>
    
    	<?php get_template_part('loop', 'feed-top-stories' ); ?>
    
    <?php endif; ?>
    <?php wp_reset_query(); ?>

    Yet when I view the page, it still displays the posts, even though they’re not set as sticky.

    Is there a way I can exclude posts that are marked as sticky?

  • The topic ‘Query Only Sticky Posts’ is closed to new replies.