Big Loop (>2000 posts) – Too big?
-
Hi, i got a blog with many articles.
$searchposts = get_posts('showposts=-1'); foreach($searchposts as $searchpost) : $posttitle=$searchpost->post_title; endforeach;
I planned to create this very simple code to check if a given post-title exists.
But I have got > 2000 Articles (Video Rental Database) and I found out that I got a limit of ‘showposts = around 500’ .
Then the site seems to keep loading or something. Nothing happens.If I decrease ‘showposts’, I get output, so the loop itself has to be okay, right?
Even if I delete following lines:foreach($searchposts as $searchpost) : $posttitle=$searchpost->post_title; endforeach;
and I have only this one line:
$searchposts = get_posts('showposts=-1');
My site is stopping and nothing happens. Any code that is following after that line will not be processed.
What limit do I exceed ?
Is there a more ressource-saving method to query all post titles?
I certainly do not have to fill the $searchposts – variable with content, custom-fields, etc. Maybe directly access the database?
- The topic ‘Big Loop (>2000 posts) – Too big?’ is closed to new replies.