• Resolved mikejandreau

    (@mikejandreau)


    With some help from the forum, yesterday, I successfully imported about 1400 rows of data into my DEV WordPress install (not my live site, thankfully.)

    However, now when I go to try to “Edit” any page, I get either a script timeout, or a memory allocation error.

    I upped both in my php.ini file, but it still seems like I’m running out of memory, and can’t get to the pages to edit them anymore.

    In total, there’s only about 1450 pages.
    The dev install has 1452 “Posts”, which works fine. Does WordPress handle memory differently in regards to posts vs. pages? Seems like I can have a zillion posts without an issue, but 1450 pages causes an issue.

    Anyone offer any advice? Is 1450 pages too many for a shared host? Should I start looking into VPS or Dedicated?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter mikejandreau

    (@mikejandreau)

    I should also note than these 1450 pages have 5 custom fields, each.

    My postmeta table grew to over 20k rows, which I think may be what’s causing the issue in part.

    I deleted all those pages, and their corresponding metadata, and everything’s working fine now. But I need to find a solution so I can continue to grow the number of pages. We add about 1 page per day, and have been doing that for 3 years now.

    Thread Starter mikejandreau

    (@mikejandreau)

    I think I solved my own problem.

    From my testing, all day, I learned that WordPress definitely handles posts and pages very differently, which is why I was running out of memory.

    The only reason, I realized, that I was using pages was so that I could utilize the custom template functionality of the pages. Then I realized I could do the same with posts, so why would it matter?

    I simple created a new single-$categoryid template, and added the following to my functions.php file for my theme:
    <?php add_filter('single_template', create_function('$t', 'foreach( (array) get_the_category() as $cat ) { if ( file_exists(TEMPLATEPATH . "/single-{$cat->term_id}.php") ) return TEMPLATEPATH . "/single-{$cat->term_id}.php"; } return $t;' )); ?>

    Now any file that’s a “single” post file, will pull single-categoryid.php as its template. Voila.

    Now I just hope WordPress can handle the thousands of posts I’m about to throw at it.

    Pretty neat solution. Thanks for sharing. May I ask why you use a separate template for all 1450+ pages (now posts)? Just for curiosity’s sake, I’m wondering how you utilize that many templates.

    Thread Starter mikejandreau

    (@mikejandreau)

    I probably should have clarified:

    The main “single.php” template is used for all “news stories” that we post.

    Then we’ve got a second template “single-1344.php” which will be used for cast member pages.

    And a third “single-1302.php” which will be used for movie reviews.

    Because the cast and movie review pages have a lot of custom fields in them that are different from each other, and the default single page, I wanted them to display differently.

    I didn’t meant to insinuate that there’s 1450 templates being used, just 3 different ones.

    Ahhh, I see. I should have caught that, but in my skimming of your post I read single-categoryid.php as single-POSTid.php.

    Obviously, there’s a big difference…1400 templates of difference, I guess. ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Too many pages?’ is closed to new replies.