A friend of mine just noticed that their site wasn't displaying pages that had a lot of content. For some reason they are just blank, and if he removes some content from the page it will display again. The 10,000 character mark seems to be the threshold - anything above and it goes blank.

I played with his templates and noticed that the content would be displayed if I used echo get_the_content() rather than the_content(), but then he loses the auto-formatting.

Has anyone run into this issue before? I've googled around and searched this site but haven't been able to find anything. Thanks in advance for any light you can shed on this!

  • 1
    Is there anything warning wise in the error log?
    – Tom J Nowell
    Feb 28 '12 at 17:06
  • 1
    Also have they tried splitting the content up into multiple pages?
    – Tom J Nowell
    Feb 28 '12 at 17:07
  • 1
    @TomJNowell Yeah, I turned on WP_DEBUG and nothing was reported, I also checked the error logs and there was nothing there. Feb 28 '12 at 17:22
  • 1
    @TomJNowell I asked if he could just split it into multiple pages, and that's the short term solution he's going with, but would still like to figure out what is causing this. Feb 28 '12 at 17:23

I ran into this problem a year or so ago, and found a fix here.

  • Open PHP.INI in a text editor of your choice (normally you can find php.ini in your php install dir)
  • Change the recursion limit to 200x normal, that is, set: pcre.recursion_limit=20000000
  • Change the backtrack limit to 100x normal, that is, set: pcre.backtrack_limit=10000000
  • Stop and start the Apache (or IIS) service

As a warning note, if you push this too far and your server is underpowered, you may end up crashing PHP as it consumes the entire stack. Your host may not be too happy about that.

If you don't have access to your php.ini, you can set these variables inside wp-config.php. Somewhere before the require_once(ABSPATH . 'wp-settings.php');, maybe in the debug area (up to you), add these two lines:

@ini_set('pcre.backtrack_limit', 10000000);

@ini_set('pcre.recursion_limit', 20000000);

  • Upping the backtrack_limit seemed to take care of it. I had to bump it up to almost 1000x the original value, which is definitely increasing load time. I might need to just turn off auto formatting... I don't really want to comment out anything in the core WP files like the article suggested as an alternative. Thanks a lot for your help! Feb 28 '12 at 19:29
  • 1
    Well, the primary issue that causes this is too many shortcodes (including wordpress-generated image shortcodes) in addition to the content. Perhaps there's a way to trim down the number of shortcodes being generated or used in your pages? I don't think leaving the backtrack_limit so high is an ideal solution, as eventually under load PHP will crash and your host will notice. Still, you've isolated the issue and you're semi-stable in the meantime, which is a step up fro where you were a few hours ago! Glad to help!
    – SickHippie
    Feb 28 '12 at 19:32
  • I just checked to see how many shortcodes he was using on that page and he actually isn't using any, so I'm not sure what would be causing the issue. No image captions or anything. But yeah, like you said, at least he's semi-stable for now. I'll make sure to follow-up if I'm able to work something out. Feb 28 '12 at 19:39
  • And no images embedded either? Images with captions are inserted as shortcodes, but if it's all just text then that's very strange. There's no real character post limit as seen here - wordpress.org/support/topic/… - so that can't be the underlying issue.
    – SickHippie
    Feb 28 '12 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.