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
);
query_posts($args);
ignore_sticky_posts
was introduced in WordPress 3.1. Before this version, you can usecaller_get_posts
, which will have the same effect (this option was used when you queried the posts viaget_posts()
, which uses the sameWP_Query
class in the background, but should ignore sticky posts). The name was a bit confusing, and thus changed in 3.1.Have you tried using
'post__in'
will be changed to'post__not_in'
in your code. Thanks!