[resolved] Can't display all posts on a page (5 posts)

  1. slicedinvoices
    Posted 3 years ago #

    I’m having trouble displaying any more than around 70 posts on one page for some reason and it seems to have only happened after updating to the latest version of WordPress. I need to display every single post (over 1500 of them) on my sitemap page and also another page.
    I am using the code below but it isn’t working

    $result = new WP_Query('posts_per_page=-1');

    I’ve also tried using the below code as well as 'showposts=1500'

    $result = new WP_Query('posts_per_page=1500’);

    But any number over 70 and I just get a blank white page.
    Anybody know why this may be? It was all working perfectly until I did some updates to plugins and to WordPress.

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    Perhaps it's a memory or timeout issue. Have you checked your server's error logs?

  3. slicedinvoices
    Posted 3 years ago #

    Thank you esmi, that was the problem.
    I'd changed the memory limit for some reason when I was messing around with something else. You're a lifesaver!

  4. devers
    Posted 3 years ago #

    I'm having a problem similar to this (actually, seemingly identical) except that I am only trying to display 200 posts. More posts exist, but WordPress seems to fail to get any more than about 150. This is after I increased PHP's memory limit to 256mb. Previously, it could only get about 60 pages using 32mb of memory. This seems like a lot of memory to get relatively few posts. Could there be another factor that is limiting the WP_Query results?

  5. esmi
    Forum Moderator
    Posted 3 years ago #

    Please post a new topic.

Topic Closed

This topic has been closed to new replies.

About this Topic