WordPress.org

Ready to get started?Download WordPress

Forums

Default and max numberposts (2 posts)

  1. frizzle
    Member
    Posted 3 years ago #

    The numberposts attribute for get_posts is very poorly documented.

    It seems that the default displayed is 5. I would have thought that by specifying numberposts=>'' you'd be saying "show all posts," but that seems to just make the maximum into 10! (How would one guess that THAT was going to be the case?)

    Implicitly, in the documentation it kind of specifies that if you set numberposts to -1, it shows all. But it never says this explicitly. On the WP Query page, you can infer this if you realize that numberposts is the same thing as posts_per_page, but you'll never figure that out with Google searches, since they are not the same thing (and numberposts never appears once on that page).

    Can someone please, PLEASE write up some actual technical documentation for this very important parameter? Are there any other tricks I should be aware of? I've now had to rewrite a TON of get_posts calls each time I figure out some sort of other behavior with numberposts, which is really quite unnecessary...

  2. I believe the 10 is grabbed from your settings (WP Admin -> General -> Reading).

Topic Closed

This topic has been closed to new replies.

About this Topic