I am trying to alter the number of items per page in a View, programmatically. When I display the Views object returned in hook_views_pre_execute, I see fields for in $view->query for items per page, etc., but despite the view initially having a setting of Display a specified number of items: 6, it appears nowhere in the object, that I can find.

  • There are two options. One, it's in $view->query. Second - it's simply not there at all, query gets all items and pagination happens later. Inspect query and you will be able to tell yourself. Don't forget to post self-answer once you'll find out!
    – Mołot
    Jun 15, 2015 at 15:33
  • I don't think those options cover things properly. I have checked the contents of $views->query also in the post_execute, pre_render and post_render hooks. In all cases the paging values are null. At SOME point, views has to have that information available in order to provide the correct number of items, so where is it?
    – JAyenGreen
    Jun 15, 2015 at 16:27
  • 1
    Any solutions for this problem ?
    – maj
    Jan 19, 2016 at 5:22

1 Answer 1


In hook_views_pre_execute (hook_views_pre_build is too early), the pager data, in general, can be found at


and the specific piece of data I asked about can be found at


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.