[wp-hackers] showposts/posts_per_page bug?
Christopher Bratlien
chrisbratlien at gmail.com
Sat Dec 4 22:22:35 UTC 2010
I've encountered this also and so my habit is to set both to -1. The way the
documentation reads, I think it sounds like a bug too.
On Sat, Dec 4, 2010 at 4:08 PM, Simon Blackbourn <piemanek at gmail.com> wrote:
> i have a custom post type called 'project', with eight published posts. if
> i
> do the following query...
>
> $projects = get_posts( array(
> 'order' => 'asc',
> 'orderby' => 'title',
> 'post_type' => 'project',
> 'posts_per_page' => -1
> ));
>
> ...only five results are returned. if i change it to...
>
> $projects = get_posts( array(
> 'order' => 'asc',
> 'orderby' => 'title',
> 'post_type' => 'project',
> 'showposts' => -1
> ));
>
> ...it correctly returns all eight posts.
>
> according to the codex page[1], showposts was deprecated in favour of
> posts_per_page, so surely these two queries should return exactly the same
> result?
>
> i tried adding 'nopaging' => true to the first query but it still only
> returns five posts. what's also odd is that five doesn't relate to any of
> my
> site's settings (i have 10 in the 'reading' options), so i've no idea where
> it comes from.
>
> i've reproduced this exact same behaviour on two sites with all other
> plugins & filters disabled, so there does certainly seem to be a bug (or
> maybe bugs) in there, but i'm not sure what exactly.
>
> anyone else encountered this?
>
> i couldn't find a trac ticket, let me know if there is one already,
> otherwise i'll open one if this is definitely a bug.
>
> cheers
> simon
>
> [1]
>
> http://codex.wordpress.org/Function_Reference/query_posts#Post_.26_Page_Parameters
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
--
Chris Bratlien
I write code (so you don't have to)
http://chrisbratlien.com | 1-979-229-5685 | Skype: chrisbratlien
More information about the wp-hackers
mailing list