[wp-hackers] limiting the number of posts
Haluk Karamete
halukkaramete at gmail.com
Thu Jan 30 19:36:57 UTC 2014
Simon, you are absolutely right.
I got confused between the numberposts, number_of_posts, showposts,
posts_per_page, foundposts. I definitely overlooked.
Thank you for nailing it for me.
On Thu, Jan 30, 2014 at 11:12 AM, Simon Blackbourn <piemanek at gmail.com>wrote:
> > posts_per_page does not have anything to do with the LIMIT phrase of
> mysql.
> >
> > What query argument corresponds to the LIMIT?
> >
> > In other words, I'd like WordPress query to return only 3 posts max,
> (even
> > though there could be thousands that match that query. )
> >
>
>
> I think you've got it wrong: if you pass a value of 3 as the posts_per_page
> argument into get_posts or a new WP_Query and inspect the query that is
> run, it will show "LIMIT 0, 3".
>
> Try the Query Monitor plugin (http://wordpress.org/plugins/query-monitor),
> it outputs nicely formatted SQL of all your database queries.
> _______________________________________________
> 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