The following code:
$params = array( 'post_type' => 'game', 'post_status' => 'publish', 'posts_per_page' => -1, ); $posts = get_posts($params);
works fine on my dev environment (MAMP), but when I try to run it on our staging environment (Apache on Linux) I get a 500 error (absolutely nothing in the source) with no error's in the error log.
When I narrow it down, I notice that if I set the posts per page to greater than 37 (we have approximately 60 posts on staging, from which I have recently updated my dev database from (meaning post 38 is in my dev as well)), all is well. All is also well when I set posts_per_page to 30, and add the parameter 'paged' => 2 (so post 38 isn't causing a problem). I have also tried setting posts_per_page to 40 and paged to 2 which currently works fine, but I suspect that is because we don't have over 80 posts.
Any idea's as to what else I could try, or what is likely to be the problem?