WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using WP 3.0.3 and I would like to exclude sticky posts from my query:

This doesn't seem to work:

<?php query_posts( 'posts_per_page=9&cat=-1,-2&ignore_sticky_posts=1' );?>

To get JUST the sticky post I use the following:

$sticky = get_option('sticky_posts');
$args = array(
    'posts_per_page' => 1,
    'post__in'  => $sticky
share|improve this question
up vote 3 down vote accepted

ignore_sticky_posts was introduced in WordPress 3.1. Before this version, you can use caller_get_posts, which will have the same effect (this option was used when you queried the posts via get_posts(), which uses the same WP_Query class in the background, but should ignore sticky posts). The name was a bit confusing, and thus changed in 3.1.

share|improve this answer

Have you tried using

query_posts( array( 'post__not_in' => get_option( 'sticky_posts' ) ) );
share|improve this answer

'post__in' will be changed to 'post__not_in' in your code. Thanks!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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