[wp-hackers] Bug with post__in in WP 3.3.1?

Andrew Nacin wp at andrewnacin.com
Sun Mar 18 21:55:01 UTC 2012


You need to pass ignore_sticky_posts => true.
On Mar 14, 2012 12:58 PM, "Nícholas André" <nicholas at iotecnologia.com.br>
wrote:

> Hi guys, I trying to get the 'Sticky' Post, but i have an issue.
>
> I have the code above:
>           sticky = get_option('sticky_posts');
>            $slidePosts = array_slice($sticky , 0,3);
>            $featuredPosts = array_slice($sticky , 4, 3);
>            $slide = new WP_Query(array('post__in' => $slidePosts));
>            if( $slide->have_posts() ) : while($slide->have_posts() ) :
> $slide->the_post()
>
> But I get all fixed posts, not the only that is in the array. If I remove
> the 'post__in' the result is the same, but the order of the elements is
> diffent( ordered by id), when i put it, the firsts elements are the
> elements in the array $slidePosts, but it still showing all posts that are
> fixed.
>
> If I put post__in => array(54) for example, all the fixed posts are
> retrivied and the post in array are the first;
>
> Is somenthing that i'm doing wrong or this is a bug?
>
> Complete Code:
> http://pastebin.com/VKn4nXzC
>
> Sorry for any mistakes on my english, i'm don't speak english very well.
> --
> Nícholas André
>
> Técnico em Informática pelo IFRN
>
> Graduando em Ciência da Computação - UFERSA
>
> Blog : www.iotecnologia.com.br
>
> Linux user number #478230.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list