• trial3rror

    (@trial_error)


    When I google I find some people saying that posts_per_page limits the query and only returns the number of posts specified in the parameter. However, others claim it is not so. Common sense to me suggests it does not limit the query but rather “segments” the query and puts one segment on each page.

    Which is it?

    My scenario:
    I want to pull only five posts from a large database and display them on my front page. I want WPQuery to stop after it finds five posts according to my criteria and not waste resources continuing going through the entire database. Does posts_per_page help me do this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Clarion Technologies

    (@clarionwpdeveloper)

    Hello trial3rror,

    Yes “posts_per_page” is the right parameter to limit/abandon the query.It gives you only 5 post according to your criteria when you pass value as 5 to it.

    Thanks

    Thread Starter trial3rror

    (@trial_error)

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Does posts_per_page limit/abandon the query?’ is closed to new replies.