I fed WordPress too much and it got a bellyache

I fed WordPress too much and it got a belly ache.

Each year, we do a “donor honor roll,” or a listing of all the people who gave money to my University in the past year. We’ve transitioned it from a print publication, sometimes inserted as part of our alumni magazine, to a stand-alone web-based site.

Basically, it’s a ton of text broken into pages based on giving levels. Some of the pages are rather short – like those that gave over $50,000. The longest list, unsurprisingly, was our list of people who gave under $1,000. It was near 30,000 words long – which is a LOT of text in one WordPress page.

As a donor to this University (and in the under $1k group), I was able to find myself using WordPress’s built-in search tool. When I went to the full list page, it was blank. Well, our header, sidebars and footer was there, but the actual page content, the stuff being pulled by the the_content() tag, was missing.

It was in the database, but WordPress wasn’t actually displaying it on the page. At all.

After some poking, I discovered that it was too much data for PHP to do any functions/plugin actions on it before it was displayed. I didn’t really want to break it into multiple pages, so I Googled around and found other people having similar problems with very long pages and posts.

The solution: change some PHP settings to up certain buffer sizes. The lines I used were this:

/** Trick for long posts */
ini_set('pcre.recursion_limit',20000000);
ini_set('pcre.backtrack_limit',10000000);

Those two lines, placed in either your php.ini file or your wp-config.php file, give PHP a bit more space and power to process large amounts of text and make sure there’s enough room to do all the processing on a post that WordPress has to do.

We host our sites on a dedicated machine, so I’m not sure what, if any, effect this will have on WordPress sites hosted on a shared server. Otherwise, I’d recommend breaking them into multiple pages or posts.

1 comment

  1. good info.been looking for this answer for a while now.

    I noticed you set yours really high though. recursion limit default is 100,000 and you set yours to 20,000,000, the back track limit I see you increased from 1,000,000 to 10,000,000.

    seems like a lot.

    you can actually try to lower it and see if the post shows up.

Leave a Reply