4

There seems to be a default limit to for loops in craft of 100.

I have a channel with quite a few entries.

How can I disable this without writing nasty things like .limit(100000000)

  • 1
    Does .limit(null) work? – joep Apr 1 '16 at 10:43
  • @user1463467 beat me to it, why not post as a real answer? – carlcs Apr 1 '16 at 10:44
  • 1
    Wasn't 100% sure and didn't want to lose my precious karma (I hate stackexchange with a passion). – joep Apr 1 '16 at 10:48
  • This question applies to Craft 2. As of Craft 3 there is no limit by default. Source: github.com/craftcms/cms/blob/develop/… – Ben Croker Jul 21 at 17:57
13

Set the limit to null limit(null).

| improve this answer | |
  • This answer applies to Craft 2. As of Craft 3 there is no limit by default so setting limit to null is not necessary unless trying to override a previously set value. Source: github.com/craftcms/cms/blob/develop/… – Ben Croker Jul 21 at 17:58
  • @BenCroker - glad I wasn't the only one who read the latest Craft Link List and suddenly thought of the Jumanji meme of "What Year is it??" :) – Patrick Harrington Jul 21 at 18:38
1

There very definitely is a default limit of 100 and using .limit(null) will definitely override it. I know this because I recently had the same issue myself!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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